We have seen how to configure system and eclipse in configuration part 1 and configuration part 2 posts to generate Selenium webdriver HTML test report. Now we have a test case and build.xml file in our project tree. Let me describe you few steps of configuring and running build.xml file in eclipse. Now follow the bellow given build.xml file configuration steps to generate HTML report.
Step 1 : Verify build.xml file work space
Open External Tools Configuration dialog as bellow
Right click on Build.xml - > Run As -> External Tools Configuration. It will open External Tools Configuration dialog as shown bellow.
In Main tab, you need to verify that your current project's build.xml is selected or not.My current project name is "JUnitReport" so it is correct for me. If it is of any other project then you need to change it by clicking on Browse Workspace button.
Step 2 : Set target execution order
Go to the target tab and then set target execution order = build, ForReport (My Project name), junitreport. If it is not in this order then you can change it by unchecking and checking and the check box or by clicking on order button. So now my target execution order will looks like bellow.
Step 3 : Set Runtime JRE
Go to JRE tab. Here you need to set Runtime JRE = JDK at place of JRE as shown in bellow image.
If JDK is not display in Separate JRE list then you can add it by
- Click on Installed JREs button. It will open Preferences dialog.
- Click on Add button from Preferences dialog. It will open Add JRE dialog.
- Select Standard VM from Add JRE dialog and click on next button as shown in bellow image.
On Next window, Select JDK folder path(Which is located at C:\Program Files\Java\ in my system) In JRE home field and click on Finish button. It will add JDK option in Separate JRE drop down.
Now build file configuration is finished and finally you are ready to run your build.xml file and generate your test report.
Step 4 : Run build.xml
Now you can run build.xml file in 3 ways.
1st way : Run from External Tools Configuration dialog as shown.
2nd way : Run directly from build.xml file
3rd way : Run from Menu icons
Step 5 : View Report
When you run build.xml file, eclipse will run your junit test case and on completion of execution report file will be generated in your junit folder which is located in your project folder as bellow.
Open index.html file. It will looks like bellow.