Introduction
In this article, I will show you the procedure to run and debug Selenium test cases from Eclipse ID. Following are the steps which we have to follow to achieve the same.
Step 1
Open Eclipse IDE.
Step 2
Create a Workspace.
Step 3
Import QA automation projects from your physical drive. Let's say C\code\QA.
The screenshot is given below for the reference.
Step 4
In Eclipse, click the Windows tab and select Preferences.
Step 5
\
Step 6
Step 7
Once Step 6 completes, it will appear, as shown below.
Step 8
Select a checkbox, as highlighted in the above screenshot, and double click on it. Once you double click on it, the screenshot given below will appear.
Step 9
Step 10
Provide the “Default VM arguments” as “-DTESTENV=localhost-DBROWSER=CHROME”. For reference, look at the screenshot given above, which is highlighted in Red.
Note
If you want to map within a production environment, then change the “Default VM arguments” as “-DTESTENV=production -DBROWSER=CHROME”.
Step 11
Open the Browser Window and give your Application URL, as shown below.
https//www.xyz-dev.com/db/?a=signin
If everything goes fine, then it will give you the screenshot, as shown below.
It should allow you to log in after clicking the Sign In button. Once you click the Sign In button, then it should redirect to the home page and the screenshot for the reference is given.
The step given above is just to make sure that the Application is up and running fine without any errors.
Step 12
Now, go to Eclipse ID, select any project and then select any smoke test class. Now, right-click on it and then click "Run As TestNG / Debug As TestNG". If you want to debug your code, then go with "Debug As TestNG", else simply go with "Run As TestNG".
For instance,
- Eclipse IDE
- ProjectAutoGrid
- Src
- xyz.test.ux.testcases.qb
- SmokeTests
The output will be, as shown below.