Drupal Test Framework: Why I chose Java/Selenium

Why Java/Selenium over Protractor/JS and Behat/PHP?

  • NodeJS
    • NodeJS has allowed JavaScript to enter into realms not considered in its inception.
    • Now that the execution engine has been liberated from a specific browser, it is free to be used in server-side implementations for a variety of applications.
    • While it is true Protractor has beautiful hooks geared towards AngularJS frameworks, it is still ultimately a WebDriver JS wrapper.
    • It a small ecosystem with just an AngularJS application, Protractor/Jasmine lend themselves perfectly to the task - given the developers are already using JavaScript & Protractor is tuned to AngularJS callbacks & bindings.
    • These tunings can be ported from the JS framework as they merely wrap the webdriver JS offering ( i.e.: Protractor/Jasmine simply 'extend' webdriver JS for easy use in an AngularJS environment )
  • Behat/PHP
    • Bhat/PHP comes closer to the look & feel of Java/Selenium Google Trends clearly shows Java/Selenium to have the lion's share of the market.
    • With usage comes support, tools, and community.
  • Java/Selenium
    • Java/Selenium allows for more diverse capability that can transcend an automation framework & allow an entire test ecosystem to arise.
    • Protractor can even be included in a Java/Selenium framework should the need arise.
    • The concerns I have with selecting JavaScript/PHP is that I would be boxed-in with a scripting language, needing to leverage another language/environment to create non-runtime tools and utilities.
    • Lastly, I always seek out stable tools for testing, especially for use in automation where things usually unattended.
  • Commentary
    • Quora hosted such a question here: https://www.quora.com/What-is-better-for-testing-a-web-application-Protractor-or-Selenium
    • StackOverflow: Java Selenium with Protractor: https://stackoverflow.com/questions/29983241/use-protractor-with-java
      • Yes; protractor is nothing more than a syntax wrapper for Selenium with a few methods that hook into the JavaScript callbacks like angular.getTestability. By copying the JavaScript code out of protractor, or ngWebDriver, etc. and into your project's executeScript or executeAsyncScript, you can modify your Selenium framework to implement watiForAngular and other Protractor methods, eliminating the need for Protractor. – emery Apr 23 at 18:52
      • The best way to use protractor is , have protractor tests separately written in javascript, and call those tests from java/python when ever required. Thats what we are currently doing!
      • All of the code is in the lib folder. A lot of it is stuff for setting up the environment or integrating with frameworks like jasmine, which you probably aren't interested in. Probably what you care about are the protractor-specific selectors, which are implemented in locators.js. Hope that helps!
    •