Testing strategies today use innovative combinations and practical solutions to make the most of the tools and frameworks available. One such prudent combination is PhantomJS used with GhostDriver. PhantomJS is a headless WebKit browser, and GhostDriver is an implementation of the WebDriver Wire Protocol that is built into the other.
PhantomJS
This is a scripted and headless browser for automating interactions of website pages. It provides APIs based on JavaScript to enable features making it a very easy to use and preferred tool to execute unit tests for the web browsers. Especially when it comes to software testing in continuous integration environments which are headless systems, PhantomJS is one of the most trusted and popular ones today.
Based on Webkit, it is available as an open source software and is released with the BSD license. PhantomJS is not a Test framework, it is used only to LAUNCH the tests via a suitable Test Runner. With a fast & native support for various Web Standards, DOM handling, CSS selector, JSON, canvas and SVG it satisfies the testing requirements of many.
A Headless Browser
This is a Web Browser without a GUI (Graphical User Interface). These browsers behave just like a real browser but don’t show any GUI. Headless browsers are used to conduct tests for central build tools without browsers installed on them. Headless browsers are also very quick and useful when there is a need to simulate multiple browser versions on the same machine.
Hitting the Popularity Charts
PhantomJS becomes the preferred one for software testing because of the fact that it is headless and avoids the need for additional overhauls with the browsers. Tests can be run on CI directly avoiding longer methodologies like Grid Hub relationships.
-
-
- Twitter uses QUnit and PhantomJS for unit testing
- LinkedIn uses PhantomJS based tools for performance testing
- Netflix relies on Sketchy, a headless browser built with PhantomJS to comprehend scenarios
- Time Warner Cable uses PhantomJS with CoffeeScript, Jasmine, and JUnit XML for Jenkins continuous integration
-
GhostDriver
GhostDriver, an implementation of the Remote WebDriver Wire protocol uses PhantomJS as its back-end. It is a pure JavaScript implementation of the WebDriver Wire protocol for Phantom. It is remote and uses PhantomJS as its backend. PhantomJS is used for Headless Testing of Web Applications that comes with in-built GhostDriver. It is also the link for Selenium WebDriver with Phantom JS.
Inspite of the fact that it is designed to be an integral part of PhantomJS, GhostDriver is designed and developed in isolation. It remains associated with PhantomJS from its very beginning and designers maintain a uniformity between the two.
GhostDriver is much easier to setup as compared to the other available alternatives to address to this need.
Headless Testing Using PhantomJS and GhostDriver
This combination can be used with
-
- Command line based traditional testing
- Within Continuous Integration Systems
Benefits of Testing Using the two together
-
-
-
-
- Faster and quicker test results are assured
- They are easily configurable with Maven and Jenkins, the most talked about CI systems today
- They support various Web Standards: DOM handling, CSS selector, JSON, canvas and SVG
- They offer swiftness in server configuration and also supports open web pages
- Allows taking screenshots and execute user actions
- The combination allows Headless testing of web applications
-
-
-
Words of Caution for the combination
-
-
-
- PhantomJS is not actually a browser, but only very close to a real browser
- Only 13 of 95 wire protocol commands are implemented for GhostDriver
- GhostDriver is still under development
-
-
On a Parting Note
An appropriate and prudent test strategy is the call of the day today. Blending in these needs with the new age tools, test frameworks and approaches ensures that the testing methodologies are reliable for the modern day requirements with the expected effectiveness.
We at Software Testing Solution ensure a right mix of Manual and Automated Testing and provide support through the Testing Life Cycle. The unbiased test reports help smoother implementations with near zero post-delivery defects and higher customer satisfaction.
Visit and request a FREE POC to Test drive our services.