Automating Test Cases Using Selenium

03 / Mar / 2022 by tushar.bansal 0 comments

Software testing is a technique which is used to ensure the proper functioning of the requirements by comparing the actual results with the expected results. To do so, we can use test scripts or use any automation testing tool like Selenium. With growing competition between IT companies, organizations are now focusing on increasing the efficiency of applications. To achieve this, organizations are switching from manual to automation testing.

In the current market situation, Selenium has evolved as one of the best automation tool for easily automating the test cases. Test automation is widely used in the automation of repetitive tasks which are difficult to perform manually, such as:

  1. Regression Testing.
  2. API Testing.
  3. Performance Testing, etc.

Strategies to automate test cases using Automation Script

The process of automating manual test cases using the Selenium WebDriver is as follows:

1. Identify the Automation Areas: This is the most important step in Automation, which is to identify that whether we need to automate these set of test cases or not? This can be easily identified by analysis of the areas that are being regressed tested/ complicated & time-taking report creation tasks.

2. Test Steps: While writing Selenium Test Script, you should ensure that the test scripts should be descriptive so that anyone who has basic knowledge in Selenium should be able to read, understand and modify the test script easily on need basis. While writing the Selenium scripts, you should have to use the logical and self-descriptive names for the methods and variables so that it will be easy for other QA’s to understand this script. Also add the descriptive comments before & after writing every test case. Moreover, add output statement as comments in the Selenium scripts.

3. Verification and Validation: Verification and validation is the step which makes the automation valuable than manual testing because in automation there is no mistake or error can happen as we validate the results with the expected result. And if it does not match then test case will be failed. Verification is the testing technique in which the product meets the requirements you have been told. And Validation is the testing which identifies how well the business requirements were addressed.  Also, nothing can be achieved in testing without the verification & validation in the automation test scripts.

4. Test Data: The test data always plays an important role in the automation testing. Because if the test data used in the automation scripts is not proper, correct & complete(i.e. Test data not covers all the possible scenarios) then the test efficiency will not be as good or as per what is expected. The data used in the scripts should always be stored in an Excel sheet so that it can be used later.

5. Test Report: Selenium is an advanced automation tool, and it has a good support on reporting add-ons that help in providing quality reports to the testers(like- Test NG Reporting Tool / Report NG / HTML Publisher + Jenkins)

6. Post Test Execution: After execution of the selenium test scripts, it is essential to close the browser-window. Also ensure to kill the connections, clear the memory, and close the application.


Leave a Reply

Your email address will not be published. Required fields are marked *