Cross Browser Testing is a type of functional test to check that your web application works as expected in different browsers.
Why do we need Cross Browser Testing?
Web based applications are totally different from windows applications. A web application can be opened in any browser by the end user. For example some people prefer to open http://twitter.comin Firefox browser, while other's can be using Chrome browser or IE.
In the diagram below you can observe that in IE, the login box of twitter is not showing curve at all corners but we are able to see it in chrome browser.
So we need to ensure that the web application will work as expected in all popular browsers, so that more people can access it and use it.
This motive can be fulfilled with Cross Browser Testing of the product.
Reason Cross Browser Issues
- Font size mismatch in different browsers.
- CSS,HTML validation difference can be there.
- Some browser still not supporting HTML5.
- Page alignment and div size.
- Image orientation.
- Browser incompatibility with OS. Etc.
How to perform Cross Browser Testing
If we are using Selenium WebDriver, we can automate test cases using Internet Explorer, FireFox, Chrome, Safari browsers.
To execute test cases with different browsers in the same machine at same time we can integrate TestNGframework with Selenium WebDriver.
Your testing.xml will look like that,
This testing.xml will map with the test case which will look like that
Here because the testing.xml has two Test tags ('ChromeTest','FirefoxTest'),this test case will execute two times for 2 different browsers.
First Test 'ChromeTest' will pass the value of parameter 'browser' as 'chrome' so ChromeDriver will be executed. This test case will run on Chrome browser.
Second Test 'FirefoxTest' will pass the value of parameter 'browser' as 'firefox' so FirefoxDriver will be executed. This test case will run on FireFox browser.