The Ranorex Report class is used to generate test execution reports during test automation. Each Ranorex based test should log at least two messages showing the start and end time of the test. The more information is logged during automation, the easier it is to find out what went wrong - as long as the generated report can be filtered too.
The Ranorex Report class provides several methods to distinguish between important test or validation logs and simple test development debug information.
All reported information is stored as a XML file.
During test development it is often necessary to log messages showing more developer specific information, therefore the Report class provides four different methods and log levels for test developers.
// Setup Reporter
Report.Setup(ReportLevel.Debug, "myReport.rxlog", true);
// Alternatively append the reports to an existing file as follows
Report.Setup(ReportLevel.Debug, "myReport.rxlog", true, true);
// Log four different levels
Report.Debug("Debug message");
Report.Info("Info message");
Report.Warn("Warning message");
Report.Error("Error message");
// Log HTML content
string htmlString = "<b style=\"color: #ee0000; border: 1px solid #ee0000; padding: 2px;\">Your HTML content</b>";
Report.LogHtml(ReportLevel.Info,htmlString);
// Stop Report - log file will be finished
Report.End();
' Setup Reporter
Report.Setup(ReportLevel.Debug, "myReport.rxlog", True)
' Log four different levels
Report.Debug("Debug message")
Report.Info("Info message")
Report.Warn("Warning message")
Report.Error("Error message")
' Log HTML content
string htmlString = "<b style=\"color: #ee0000; border: 1px solid #ee0000; padding: 2px;\">Your HTML content</b>"
Report.LogHtml(ReportLevel.Info,htmlString)
' Stop Report - log file will be finished
Report.End()
# Setup Reporter
Report.Setup(ReportLevel.Debug, "myReport.rxlog", True)
# Log four different levels
Report.Debug("Debug message")
Report.Info("Info message")
Report.Warn("Warning message")
Report.Error("Error message")
# Log HTML content
string htmlString = "<b style=\"color: #ee0000; border: 1px solid #ee0000; padding: 2px;\">Your HTML content</b>"
Report.LogHtml(ReportLevel.Info,htmlString)
# Stop Report - log file will be finished
Report.End()
From the perspective of a test manager, it's more important to know whether the test failed or not. Use the following methods to log more test specific information. Additionally the Validate class automatically reports successful or unsuccessful validations.
// Setup Reporter
Report.Setup(ReportLevel.Debug, "myReport.rxlog", true);
// Log test specific information
Report.Failure("Test case failed");
Report.Success("Test case successfully finished");
Ranorex.Validate.AreEqual("compareText", "compareText","String comparison", true);
// Log current system environment
Report.SystemSummary();
Report.End();
' Setup Reporter
Report.Setup(ReportLevel.Debug, "myReport.rxlog", True)
' Log test specific information
Report.Failure("Test case failed")
Report.Success("Test case successfully finished")
Ranorex.Validate.AreEqual("compareText", "compareText", "String comparison", True)
' Log current system environment
Report.SystemSummary()
Report.End()
# Setup Reporter
Report.Setup(ReportLevel.Debug, "myReport.rxlog", True)
# Log test specific information
Report.Failure("Test case failed")
Report.Success("Test case successfully finished")
Ranorex.Validate.AreEqual("compareText", "compareText", "String comparison", True)
# Log current system environment
Report.SystemSummary()
Report.End()
// Setup XMLLogger to append to an existing file ... XmlLogger.AppendExisting = true; // ... or use the 4th optional parameter value to true Report.Setup(ReportLevel.Debug, "myReport.rxlog", true, true);
' Setup XMLLogger to append to an existing file ... XmlLogger.AppendExisting = true ' ... or use the 4th optional parameter value to true Report.Setup(ReportLevel.Debug, "myReport.rxlog", true, true)
# Setup XMLLogger to append to an existing file ... XmlLogger.AppendExisting = true # ... or use the 4th optional parameter value to true Report.Setup(ReportLevel.Debug, "myReport.rxlog", true, true)
// Setup Reporter
Report.Setup(ReportLevel.Debug, "myReport.rxlog", true);
// Get calculator application and one element
// just for screen shot report
Ranorex.Form calcForm = "/form[@title='Calculator']";
Text textBox = "/form[@title='Calculator']/text[@controlid='403']";
calcForm.EnsureVisible();
// Logs the current desktop view
Report.Screenshot();
Report.Screenshot(calcForm);
Report.Screenshot(textBox);
Report.End();
' Setup Reporter Report.Setup(ReportLevel.Debug, "myReport.rxlog", True) ' Get calculator application and one element ' just for screen shot report Dim calcForm As Ranorex.Form = "/form[@title='Calculator']" Dim textBox As Text = "/form[@title='Calculator']/text[@controlid='403']" calcForm.EnsureVisible() ' Logs the current desktop view Report.Screenshot() Report.Screenshot(calcForm) Report.Screenshot(textBox) Report.End()
# Setup Reporter
Report.Setup(ReportLevel.Debug, "myReport.rxlog", None)
# Get calculator application and one element
# just for screen shot report
calcForm = Form("/form[@title='Calculator']")
textBox = Text("/form[@title='Calculator']/text[@controlid='403']")
calcForm.EnsureVisible()
# Logs the current desktop view
Report.Screenshot()
Report.Screenshot(calcForm.Element)
Report.Screenshot(textBox.Element)
Report.End()
// Set user defined stylesheet file
XmlLogger.SetReportStylesheetFile("userDefinedStylesheet.xsl");
// Setup reporting
Report.Setup(ReportLevel.Debug, "myReport.rxlog", true);
' Set user defined stylesheet file
XmlLogger.SetReportStylesheetFile("userDefinedStylesheet.xsl")
' Setup reporting
Report.Setup(ReportLevel.Debug, "myReport.rxlog", true)
# Set user defined stylesheet file
XmlLogger.SetReportStylesheetFile("userDefinedStylesheet.xsl")
#/ Setup reporting
Report.Setup(ReportLevel.Debug, "myReport.rxlog", true)
// Setup Reporter to default values Report.SetupDefault();
' Setup Reporter to default values Report.SetupDefault()
# Setup Reporter to default values Report.SetupDefault()
After saving a recording to a specific file, the Recorder automatically creates a report file for each play event. The generated file name contains an additional time stamp and is located within the same folder as the recording file.
Online User Guide
download as: PDF
