My Innovative Solution to Test Automation: Run the same test against a different browser at a click of a button
This is included in the “My Innovative Solution to Test Automation and Continuous Testing” series.
A decade ago, cross-browser testing was a hot topic. Why? There was no absolute dominated browser then (now, there is, Chrome). A serious web app needs to be verified on at least three major browsers: Internet Explorer, Chrome and Firefox. SauceLabs and BrowserStack are two companies that grew rapidly because of the need for cross-browser testing. Compared to the above, I had a much simpler and cheaper way to conduct cross-browser testing, using the BuildWise CT server. But it was the perspective of test suite execution. How to effectively perform cross-browser testing at the individual test level, i.e, at developing/debugging time?
Seeing this need, I worked out an easy solution with TestWise IDE: run the same test against a different browser with a click of a button.
Table of Contents:
· Selenium Tests that support multi-browsers
· Run the same test against different browsers with a click of a button
∘ From Command Line
∘ In TestWise tool
Selenium Tests that support multi-browsers
Selenium WebDriver provides the best multi-browser support as it is the only automation framework that is supported by all major browser vendors. To run one test with a specific browser is simple.
driver = Selenium::WebDriver.for(:chrome)
To change from Chrome to Firefox,
driver = Selenium::WebDriver.for(:firefox)
To make the switch easy for all test scripts, I introduce a helper method
@driver = Selenium::WebDriver.for(browser_type)
In the test helper (shared by all test scripts, see Maintainable Automated Test Design):
:chrome # or :firefox, :ie
Most automated testers can reach this stage.