In this article, we learn how to execute failed test cases in TestNG by using Selenium WebDriver
I. Create a Selenium ProjectStep 1: Launch the Eclipse and Create a New Java project by clicking File > New > Java Project
Step 2: Enter Project Name > Choose execution environment > Select Project layout option > Click on the Finish button.
When you click on the finish button the “ProjectTest” java project is created and looks like
Step 3: Expand the newly created project. You will able to see the “src” folder. Right-Click on src folder > Select New > Click Package
Step 4: In this step, enter the Package Name and click on the Finish button.
After clicking on “finish” button the project structure will look like
Step 5: Right-click on the newly created package and select New > Select Class.
Step 6: In this step,
- Enter the “class” name
- Select modifiers
- Browse and select superclass java.lang.object
- Click on the finish button.
Here, you are creating two classes ex: TestA, TestB.
First Create Class TestA.
When you click on the “Finish” button it will create a class like:
Similarly, create a class TestB. When you click on the “Finish” Button class will look like:
Step 7: To Execute Failed Test Cases If you have installed the TestNG library just click on Java Project and select >Properties.
Step 8: In the properties window, click on Java Build Path > Click on Libraries > Click on Add Library.
Click on “TestNg” and Click on the “Next” button.
Then click on the “Finish” button.