TDD (test driven development) and BDD (behavior driven development) are unique software development techniques that differ in what they are testing and how they are testing it. Despite their similar names, they serve distinct purposes. What Is TDD? TDD stands for test...
Complex report customization
In this chapter, you’ll find instructions on how to perform a range of more complex report customizations. Since they require coding skills, you should be familiar with code modules in Ranorex Studio.
Download the sample solution
The examples in this chapter are based on a sample solution that you can download from the link below.
Install the sample solution:
Unzip to any folder on your computer.
Start Ranorex Studio and open the solution file
The standard report classes
The easiest way to create a report message in code is using one of the six different standard report classes.
Standard report classes
Ranorex Studio has six standard report classes, as shown below. These classes correspond to the standard report levels.
Report messages from standard report classes
Report with user code actions
In addition to using code modules, you can also create report messages in recording modules with user code actions.
Ranorex Studio fundamentals > Actions > ⇢ User code actions.
ReportInformation()and open it.
Customize the default report category
By default, the category of custom report messages is User. You can change this to a different value, either on a per-message basis or for all messages until you change it back.
Defining a temporary custom report category
Change default category
Defining a permanent custom report category
Define custom report levels
You can define report levels with a custom name and value.
Format custom report levels
Set threshold report level with custom report levels
In this example, you’ll set the threshold report level for messages using a custom report level.
Override current report level
You can override the current report level with the special report level Always.
Overriding the current report level
Report a system summary
Add customized data
You can collect customized data during a test run and write it to the raw data file (.rxlog.data) that’s used to generate the final report.
Add custom data to raw data file
Customized data collection is triggered by a user code action with a method that tracks customized data.
The activity stack is where all activities during a test run are collected by means of a stack data structure.
The activity stack method CustomProperties adds a reported activity to the activity stack. It is defined by two strings, name (e.g. myName) and value (e.g. myValue).
- The result is a custom data field pair in the corresponding data file
- If you want to apply the test data outside of Ranorex Studio report generation, you can parse the XML file as needed.
- To include the custom data in a Ranorex Studio report, please refer to the next section.
Include custom data in report
Add the code in the picture below to the file.