Showing posts with label Generating HTML Result file. Show all posts
Showing posts with label Generating HTML Result file. Show all posts

Monday, 3 February 2014

Generating HTML result file using Selenium Webdriver


1.       Generate HTML Result file:

Reports are really worth to show the client, what we are doing, what we executed, Steps fail, Steps passed…etc.
   Selenium does not have any capability to do generate HTML result file, we can generate up to some extent HTML results file using the ANT Framework, but still those results are not descriptive ,To generate user friendly and clear cut results we should have some mechanism to generate the html results.

Below post can give you a good basic information about your test execution results:

STEPS TO FOLLOW:


1.      Add the ‘testUtils.pro jar’ (I will provide the .Jar file ) file to your project class path,Download the jar file from https://drive.google.com/file/d/0B9ZTXXKTZAYVUjhRYnNpRFV0aDA/view?usp=sharing



2.      Import the following class in your Test.java file
  Import com.webdriver.framework.*;

3.      Create an  object for GenerateResult Class
       
4.      Add a step to generate result file
       
Note: Here is will create a result file with the parameter you passed, appended with timestamp.

Example Result file screen shot:

5.     Now write your step like this                   
                           

                     
6.        Put all your test case steps into try-catch block as below :






7.      Now  Run your scripts, and look into you workspace folder, there will be new folder created with the name ‘Results’ to store the html results file, and another file named as ‘Screenshots’ will be create at the same location, to take the screenshots of the application for the failed test cases.



Sample Result file:
If Passed:
   


If Failed: