Testing is a repetitive process. Any modification in code must be tested to ensure the software application is providing the desired functionality and result. Repeating the tests manually cost time and money. We can improve efficiency and overcome such costs by automating the test scripts, where applicable.
There are a number of commercial and open source tools available for assisting with the development of test automation. We chose Selenium for regression testing due to its advantages described below.
Advantages of using Selenium:
Selenium finds wide usage for UI, regression, and acceptance testing. Following are the advantages:
- It is an open-source tool
- Supports multiple browsers
- Supports multiple programming languages
- Scripts can be executed on multiple platforms
- Results can be reported with ease and shared to others
We use TestNG framework to run selenium tests and publish the results.
TestNG has the capability of generating human-readable test execution reports automatically. These reports can be viewed in any browser as well as using Eclipse’s built-in web browser.
Advantages of TestNG
- We can add annotations easily when compared to JUnit
- Test reports can be set based on the requirement
- Concurrent execution of test scripts
- Test case dependencies arranged in a pattern
Integrating Selenium with CI [Jenkins]
As Industry is moving towards Agile Development, it is very important to integrate the tests with a CI tool so that as soon as a build is deployed, CI tool can trigger the Selenium test Job to run the test and publish the results.
Following is the procedure to integrate the CI tool:
- Create Jenkins Maven Job to trigger the Selenium tests after the deployment
- Configure the TestNG reports in post build actions
- Configure to send mail report to the project stake holders