Lesson 8: Reporting

By default each run of a test suite, a test case or a single recording generates a report file (*.rxlog) which informs you about whether the run was successful or not. Within the following lesson you will learn about the following:

Reading Ranorex Reports

After executing a test suite in Ranorex Studio the generated report file is shown in the file view as follows.
Ranorex report file generated after running a test suite within Ranorex Studio
Ranorex report after running a test suite

The report shown after running a test suite provides a general overview about how many of the test cases have been executed successfully, failed or blocked. Each executed test case and all its child modules can be analyzed more in depth by expanding a particular test case.

In addition a test suite report also informs you about the following:

  • System related information like execution time, machine name, operating system, screen dimensions, language, duration
  • Global parameter values

If a test case uses local parameter values or external test data, the report shows the values used during automation as follows:
Detailed view of a test case report
Detailed view of a test case report

The low-level log messages generated by a recording or by a code module shown in the figure above consist of a time stamp, a report level, a category and message text. By default logging is turned on for recordings. Use the Recorder's settings dialog to change the default value and to turn off logging for new recordings. In order to turn logging off or on for a particular action item, open the properties and set the 'Use Default Logging' attribute to false.

Jump to Item and Analyze with Spy

Expand the report as shown above and move the mouse pointer over the first log message.

Debug a test run with quick links 'Jump to Item' and 'Open in Spy'
Debug a test run with quick links 'Jump to Item' and 'Open in Spy'

Click at 'Jump to Item' to open the module and to focus on the source action item. Use the quick link 'Open in Spy' to analyze the RanoreXPath expression used for the particular action item. This is especially useful in situations when a test run fails with the message 'Failed to find item...' error message.

Filter Log Messages

Use the checkboxes shown at the top of each module to filter log messages.
Filter for different log levels
Filter for different log levels

Report Folder

For each run of a test suite, a single test case or a recording a new log file (*.rxlog) is generated and saved in the project's 'Report' folder. You can open older report files by double-clicking the file in the project view. Specify the file names used for the report files within the test suite's settings dialog.

Log file history within Ranorex Studio project
Log file history within Ranorex Studio project
Note: It is not required to run Ranorex Studio to open a report file. You can also open the report file from the Windows Explorer. If you're going to copy or send the file by email always ensure that the stylesheet file 'RanorexReport3.xsl' is located in the same target directory.

Logging Individual Information

Use code actions or code modules to log individual messages to the report file as shown below:

C#

Report.Debug("Debug message");
Report.Info("Info message");
Report.Warn("Warning message");
Report.Error("Error message");

// Define your own custom report level called "Custom" with level set to 100
Report.Log(ReportLevel.Parse("Custom;100"), "User", "test", new RecordItemIndex(-1));
			
// Get windows start button ...
Ranorex.Button windowsStartButton= Host.Local.FindSingle("button[@text='Start']");
// ... and create a screenshot for the report
Report.Screenshot(windowsStartButton);
						
// Simple 'AreEqual' validation
Ranorex.Validate.AreEqual("compareText", "compareText","String comparison",true);
// Log current system environment
Report.SystemSummary();
Report file with individual log messages
Report file with individual log messages
Note: A test case's failure depends on whether a Ranorex exception has been thrown or not. This could automaticaly happen if a validation step fails or a new Ranorex exception is thrown.