Eclipse And Ant Configuration Steps To Generate webdriver test execution report using JUnit : Part - 2

Webdriver test result generation is very important and essential part of automation testing and for that you need to configure your eclipse accordingly. Before eclipse and ant configuration, you need to configure your system as described in Part - 1. Now let me describe you the steps of eclipse configuration to generate web driver test execution report using JUnit. Perform bellow given steps.

Step 1 : Create new JUnit Test Case
First of all, you need to create JUnit test case in eclipse as described in JUnit Test Creation Post 1 and Post 2.

Step 2 : Set Ant Home Entries
To set ant home entries, 
- Go to eclipse Menu -> Window -> Preferences. It will open eclipse preference dialog. 
- Select Ant -> Runtime from left side preference tree. Now select Classpath at right side.
- Select 1st class path Ant Home Entries and click on Ant Home button and select 'apache-ant-1.9.2' folder path and then click on OK as shown in bellow image.


Step 3 : Set junit.jar path in Blobal Entries of Ant Runtime Preference if it is not there
As described above, Go to Ant -> Runtime preference settings and select Global Entries
Now click on Add External Jars button and select 'junit.jar' located at eclipse -> plugins -> org.junit_4.11.0.v201303080030 (This folder name may be different if you have different version of junit) -> junit.jar. and then click on OK as shown in bellow image.


Step 4 : Generate build.xml for your project
Now you need to generate build.xml for your project. To generate it, Right click on your project folder and select Export. It will open Export dialog as shown in bellow image.

Select Ant Buildfiles from export dialog and clicking on Next button will show you all your projects list. On Next dialog, select your current project and click on Finish button as shown bellow.


Look in above image. When you will run build.xml file, your test reports will be saved in JUnit output directory = 'junit' folder. It will be created automatically in your project folder when you run build.xml file. We will learn how to run build.xml file in my next post.

When you click on Finish button, build.xml file will be generated inside your project folder as shown bellow.


View my Next Post to see how to configure and run build.xml file to generate your test case report in HTML view.

4 comments:

  1. Please provide the complete code. I am new to Selenium and JAVA.

    ReplyDelete
  2. How to create Xslt report with TestNG framework?

    ReplyDelete
  3. I get the file to work but it does not look like yours. It's just a basic XML output file, not graphical with tables.

    ReplyDelete