How to Customize Report of Ranorex Tool?
Ranorex is a tool to perform automated testing of mobile, web, and desktop based applications. It uses its own format to generate a default report. However, it provides very little information. For example, information related to server, browser, Java version, etc. doesn’t show up.
In order to overcome this situation, the report can be customized to show the required information. The report can be generated in a tabular form with information related to server, build number, browser, Java version, number of Passed/Failed/Skipped test cases, and more.
Before customizing the report, you need to first create a project on Ranorex tool and add some recording module into it. Once you have created the project and recorded the module, you need to follow the steps mentioned below.
- Open the suite (.rxtst) file and drag the entire recorded module into it.
2. Configure the default reporting system in Ranorex: Right-click the ‘RanorexDemo-Test Suite > Global Parameters..’ and click the ‘Report’ tab.
3. Click the ‘Create Custom Template’ button. You can see that ‘.\NewCustomTemplate1\’ is displayed in the ‘Report Template Folder’ field.
4. You can find the ‘NewCustomTemplate1’ directory in your project folder. If you open the ‘NewCustomTemplate1’ directory, you can see a few important files which will be used during customization.
5. Run the suite file and see the default generated report.
The above generated report doesn’t show the information related to browser, server, Java version, number of Passed/Failed/Skipped test cases in a tabular format.
So, in order to customize the Ranorex report, two files are very important: RanorexReport.xsl and View.rxlog.data. With the help of these two files, you will be able to customize the report. In the RanorexReport.xsl file, codes are written in the XSLT language. It fetches the data from the data file and displays in a visual format. In the View.rxlog.data, all the data related to execution are stored.
However, before you start customization, you should have adequate knowledge of the HTML and XSLT language.
Once you customize the report, you can see the changes you have made in the existing report. Some of the changes that can be done include the following.
- Browser/Build Version/Java Version details
- ‘Test Run Summary’ table and number of total test cases, Total Passed, Total Failed, and Total Skipped test cases
- The Passed/Failed/Skipped test cases in detail with reason in a tabular format
You can customize the report as per your requirement. Some of them are discussed below.
- Show Pass/Fail/Skipped test cases into table format
If you want to show all the Passed/Failed/Skipped test cases in a tabular format, open the RanorexReport.xsl file and add a few lines of code in HTML format.
To show all failed scripts, you need to add the code mentioned below in the XSLT language in the same file.
To show all skipped test cases, you need to add the code mentioned below in ‘.xsl’ file.
To show all passed test cases, you need to add the code mentioned below in ‘.xsl’ file.
The above code will fetch the data from the ‘View.rxlog.data’ file and will show on the report.
If you want to show Browser/Java or Build Version in your report, you need to add the below XSLT language code in ‘.xsl’ file.
The above code will fetch the data from the ‘.data’ file.
If you want to show total number of Passed/Failed/Skipped test cases, you need to add the below XSLT language code in ‘.xsl’ file. It will fetch the number of counts from the ‘.data’ file and will show in the report.
Below is the ‘.data’ file.