There has been a perceptible shift in the software development industry towards creating applications for mobile platforms that mostly use a web interface. With Agile methodology driving application development today, automated testing has become the need of the hour.
Selenium WebDriver is an open source automation tool which has become quite popular in software quality assurance. Not only this, you can also leverage Selenium WebDriver to generate routine reports on project status.
Aptly named after the trace mineral "selenium", which has tremendous health benefits even in small doses*, Selenium WebDriver also is good for you!
Let’s see how.
Selenium WebDriver was initially built as an automation tool for software testing. It works across all the main browsers such as Firefox, Chrome, Internet Explorer, Opera and Safari and deploys on Windows, Linux and Macintosh. It can be used with equal ease in cloud testing.
Selenium WebDriver simulates user actions on web browsers; it provides methods for locating UI elements and comparing the expected results with actual application behavior at the user end.
The tests can be set up in any of the programming languages like Python, Java, Ruby, PHP or C#. Selenium WebDriver makes direct calls to the Web browser and drives the browser by using its native API.
Not only does Selenium WebDriver make it easy to automate testing, you can automate routine and repetitive tasks too! For instance, if you want your received mail to be sorted on the basis of certain keywords and stored in separate folders for easy access later, you can put Selenium WebDriver to the task.
Selenium WebDriver can be used with performance testing tools like Apache JMeter and SoapUI. Selenium is ideal as it can be run headless; this helps avoid the overhead of multiple instances of the web browser running in separate tabs. This could otherwise affect the results of performance tests.
As you can see in the above image, you can create a framework that will leverage Selenium to automate tests.
Selenium WebDriver framework code includes ID values of all the html fields and tests use this to interact with the web app. The good thing about this tiered framework is that the tests themselves are insulated from any changes in the page(s) of the web app. Only the ID value of the html field needs to be changed in the Selenium WebDriver framework code, if they change in the application, and all tests will still work!
To compile test results, you will have to use Selenium WebDriver with a unit testing interface like NUnit. This is how you do it:
using NUnit.framework;
using openQA.Selenium;
2. In the project, set the ‘start external program’ path to the location of the NUnit .exe file.
3. In Nunit, specify the location of the project (.dll) file.
4. Click on ‘Run’.
The tests will be executed and the results will be displayed in the NUnit GUI window as shown in this image:
Selenium WebDriver helps you direct test results to a QA database. This will make it easy to pull some vital QA analytics, like testing intensity, quality indicator and tester confidence to assess the health of the project. These data help the product manager in quantifying the risk assessment.
The code written for automation should be accurate and true to testing goals; otherwise there is the possibility that a false positive result may end up complicating the testing process and slowing it down, which is definitely not an option in today’s tech climate of faster app releases.
* Although, apparently the story goes that Selenium was originally the cure for Mercury poisoning, and guess what major player was on the early QA tools scene?