Table of Contents

Class TestReport

Namespace
Ranorex.Core.Reporting
Assembly
Ranorex.Core.dll

Provides structured reporting functionality for Ranorex test suites.

public class TestReport
Inheritance
TestReport
Inherited Members

Constructors

TestReport()

public TestReport()

Properties

CurrentModuleGroupFolderActivity

Returns the ITestFolderActivity for the currently active module group folder.

public static ITestFolderActivity CurrentModuleGroupFolderActivity { get; }

Property Value

ITestFolderActivity

CurrentTestContainerActivity

Returns the Activity for the currently active 'test case' or 'smart folder'.

public static ITestContainerActivity CurrentTestContainerActivity { get; }

Property Value

ITestContainerActivity

Remarks

If called from a module at run time, this will be the first active ancestor 'test case' or 'smart folder'.

CurrentTestEntryIterationContainerActivity

Returns the ITestEntryIterationContainerActivity for the currently active activity run as an iteration.

public static ITestEntryIterationContainerActivity CurrentTestEntryIterationContainerActivity { get; }

Property Value

ITestEntryIterationContainerActivity

Remarks

If called from a module at run time, this will be one of the following. -The iteration container of the current ITestContainerActivity if it is run with 'data rows' or has an iteration count greater than 1. -The iteration container of the current ITestModuleActivity if the module has an iteration count greater than 1.

CurrentTestIterationActivity

Returns the active ITestIterableActivity of the currently active ITestEntryIterationContainerActivity.

public static ITestIterableActivity CurrentTestIterationActivity { get; }

Property Value

ITestIterableActivity

Remarks

The ITestIterableActivity represents the report activity of an TestSuiteEntry run as an iteration. This is usually the current ITestContainerActivity but may also be ITestModuleActivity.

CurrentTestModuleActivity

Returns the Activity for the currently active test module.

public static ITestModuleActivity CurrentTestModuleActivity { get; }

Property Value

ITestModuleActivity

CurrentTestModuleGroupActivity

Returns the Activity for the currently active test module group.

public static ITestModuleGroupActivity CurrentTestModuleGroupActivity { get; }

Property Value

ITestModuleGroupActivity

CurrentTestSuiteActivity

Returns the Activity for the currently active test suite.

public static ITestSuiteActivity CurrentTestSuiteActivity { get; }

Property Value

ITestSuiteActivity

EnableTracingScreenshots

Determines whether screenshots should be made for every step. This provides a number of screenshots in case an error occurs.

public static bool EnableTracingScreenshots { get; set; }

Property Value

bool

MinimumJUnitReportLevel

Gets or sets the minimum ReportLevel that a message needs to have to be included in the JUnit report.

public static ReportLevel MinimumJUnitReportLevel { get; set; }

Property Value

ReportLevel

The minimum report level that log entries need to have to be included in the JUnit report.

Remarks

The default level is Error.

ReportEnvironment

Provides access to all filenames and path used by the report.

public static ReportEnvironment ReportEnvironment { get; }

Property Value

ReportEnvironment

ReportWriteInterval

The time interval for the current report to be saved to the target file.

public static Duration ReportWriteInterval { get; set; }

Property Value

Duration

ThumbImageWidth

The width (in pixels) of thumbnail images included in the report.

public static int ThumbImageWidth { get; }

Property Value

int

Remarks

The default value is 150px.

TracingScreenshotCountLocal

Gets or sets the number of tracing screenshots hold per module. The tracing screenshots are stored and shown in the report in case the module fails.

public static int TracingScreenshotCountLocal { get; set; }

Property Value

int

TracingScreenshotMode

Determines if tracing screenshots are taken in the background (non-blocking) or foreground (blocking).

public static TestReport.ScreenshotMode TracingScreenshotMode { get; set; }

Property Value

TestReport.ScreenshotMode

TracingScreenshotQuality

The JPEG quality for tracing screenshots (10-100, defaults to 40).

public static int TracingScreenshotQuality { get; set; }

Property Value

int

VideoRecording

Provides access to video recording functionality used by the test report

public static VideoRecording VideoRecording { get; }

Property Value

VideoRecording

Methods

BeginSmartFolderContainer(string, string, ActivityExecType, int, IDictionary<string, string>, IDictionary<string, string>, string)

Creates a new TestContainerActivity of type SmartFolder and pushes it on the ActivityStack.

public static void BeginSmartFolderContainer(string containerName, string comment = null, ActivityExecType executeType = ActivityExecType.Execute, int iterationIndex = 1, IDictionary<string, string> dataRowOrParams = null, IDictionary<string, string> parametermasks = null, string iterationLabel = null)

Parameters

containerName string

The name of the 'smart folder'.

comment string

Additional text for this test container. This will be displayed as detail under the activity name in the report.

executeType ActivityExecType

Used to indicate the context the TestContainerActivity run in.

iterationIndex int

The index of the iteration (starts at one by convention).

dataRowOrParams IDictionary<string, string>

The current 'data row' or 'params' of the 'smart folder'

parametermasks IDictionary<string, string>

The current mask status of the params

iterationLabel string

The label of the iteration in report.

Remarks

BeginTestCaseContainer(string, string, ActivityExecType, int, IDictionary<string, string>, IDictionary<string, string>, string)

Creates a new TestContainerActivity of type TestCase and pushes it on the ActivityStack.

public static void BeginTestCaseContainer(string containerName, string comment = null, ActivityExecType executeType = ActivityExecType.Execute, int iterationIndex = 1, IDictionary<string, string> dataRowOrParams = null, IDictionary<string, string> parametermasks = null, string iterationLabel = null)

Parameters

containerName string

The name of the 'test case'.

comment string

Additional text for this test container. This will be displayed as detail under the activity name in the report.

executeType ActivityExecType

Used to indicate the context the TestContainerActivity run in.

iterationIndex int

The index of the iteration (starts at one by convention).

dataRowOrParams IDictionary<string, string>

The current 'data row' or 'params' of the 'smart folder'

parametermasks IDictionary<string, string>

The mask status of the params

iterationLabel string

The label of the iteration in report.

Remarks

BeginTestContainerSetup()

Creates a new Activity of type Setup container and pushes it on the ActivityStack.

public static void BeginTestContainerSetup()

BeginTestContainerTeardown()

Creates a new Activity of type Teardown container and pushes it on the ActivityStack.

public static void BeginTestContainerTeardown()

BeginTestEntryContainer(int, string, ActivityExecType, TestEntryActivityType)

Creates a new TestEntryContainerActivity and pushes it on the ActivityStack.

public static void BeginTestEntryContainer(int iterationIndex, string entryName, ActivityExecType executeType, TestEntryActivityType entryActivityType)

Parameters

iterationIndex int

The index of the iteration (starts at one by convention).

entryName string

The name of the TestSuiteEntry.

executeType ActivityExecType

The ActivityExecType of this activity.

entryActivityType TestEntryActivityType

The TestEntryActivityType of this activity.

Remarks

For each BeginTestEntryContainer() called, EndTestEntryContainer() must be called, too.

BeginTestEntryIterationContainer(string, int, IterationExecType, TestEntryActivityType, string)

Creates a new ITestEntryIterationContainerActivity and pushes it on the ActivityStack.

public static void BeginTestEntryIterationContainer(string entryName, int iterationCount, IterationExecType iterationExecuteType, TestEntryActivityType entryActivityType, string comment = "")

Parameters

entryName string

The name of the entry that will be iterated over.

iterationCount int

The data or run iteration count

iterationExecuteType IterationExecType

The ActivityExecType of this activity..

entryActivityType TestEntryActivityType

The type of activity that will be iterated over

comment string

Additional text for this test container. This will be displayed as detail under the activity name in the report.

Remarks

BeginTestModule(string, int, ActivityExecType)

Creates a new TestModuleActivity and pushes it on the ActivityStack.

public static void BeginTestModule(string testModuleName, int iterationIndex = 1, ActivityExecType executeType = ActivityExecType.Execute)

Parameters

testModuleName string

The name of the test module.

iterationIndex int

The index of the iteration (starts at one by convention).

executeType ActivityExecType

The ActivityExecType of this activity.

Remarks

If a test module is already on top of the stack, it is removed first (with default status).

BeginTestSuite(string)

Creates a new TestSuiteActivity and pushes it on the ActivityStack.

public static void BeginTestSuite(string testSuiteName)

Parameters

testSuiteName string

The name of the test suite.

BeginTestSuite(string, string)

Creates a new TestSuiteActivity and pushes it on the ActivityStack.

public static void BeginTestSuite(string testSuiteName, string runLabel)

Parameters

testSuiteName string

The name of the test suite.

runLabel string

An optional run label. This will be displayed below the testsuite name in the report header section.

BeginTestSuite(string, string, IDictionary<string, string>)

Creates a new TestSuiteActivity and pushes it on the ActivityStack.

public static void BeginTestSuite(string testSuiteName, string runLabel, IDictionary<string, string> parameters)

Parameters

testSuiteName string

The name of the test suite.

runLabel string

An optional run label. This will be displayed below the testsuite name in the report header section.

parameters IDictionary<string, string>

A list of parameters for the test suite. This will be displayed as key/value pairs in the report header section.

Clear()

Clears the current test report, removing all information logged up to this point.

public static void Clear()

EndSmartFolderContainer()

Removes the current TestContainerActivity of type SmartFolder from the ActivityStack, with the result calculated from its child items.

public static void EndSmartFolderContainer()

EndSmartFolderContainer(TestResult)

Removes the current TestContainerActivity of type SmartFolder from the ActivityStack and updates its TestResult.

public static void EndSmartFolderContainer(TestResult result)

Parameters

result TestResult

The TestResult of the completed test container.

EndTestCaseContainer()

Removes the current TestContainerActivity of type TestCase from the ActivityStack, with the result calculated from its child items.

public static void EndTestCaseContainer()

EndTestCaseContainer(TestResult)

Removes the current TestContainerActivity of type TestCase from the ActivityStack and updates its TestResult.

public static void EndTestCaseContainer(TestResult result)

Parameters

result TestResult

The TestResult of the completed test container.

EndTestContainerSetup()

Removes the current Activity of type Setup from the ActivityStack.

public static void EndTestContainerSetup()

EndTestContainerSetup(TestResult)

Removes the current Activity of type Setup from the ActivityStack and updates its TestResult.

public static void EndTestContainerSetup(TestResult result)

Parameters

result TestResult

The TestResult of the completed setup container.

EndTestContainerTeardown()

Removes the current Activity of type Teardown from the ActivityStack.

public static void EndTestContainerTeardown()

EndTestContainerTeardown(TestResult)

Removes the current Activity of type Teardown from the ActivityStack and updates its TestResult.

public static void EndTestContainerTeardown(TestResult result)

Parameters

result TestResult

The TestResult of the completed test container teardown.

EndTestEntryContainer()

Removes the current ITestIterableActivity from the ActivityStack, with the result calculated from its child items.

public static void EndTestEntryContainer()

EndTestEntryContainer(TestResult)

Removes the current ITestIterableActivity from the ActivityStack and updates its TestResult.

public static void EndTestEntryContainer(TestResult result)

Parameters

result TestResult

The TestResult of the completed test iteration.

EndTestEntryIterationContainer()

Removes the current Ranorex.Core.Reporting.TestEntryIterationContainerActivity from the ActivityStack, with the result calculated from its child items.

public static void EndTestEntryIterationContainer()

EndTestEntryIterationContainer(TestResult)

Removes the current Ranorex.Core.Reporting.TestEntryIterationContainerActivity from the ActivityStack and updates its TestResult.

public static void EndTestEntryIterationContainer(TestResult result)

Parameters

result TestResult

The TestResult of the completed test container.

EndTestModule()

Removes the current TestModuleActivity from the ActivityStack. The module is marked as 'Failed' if the module contains any 'Failure' level messages.

public static void EndTestModule()

EndTestModule(TestResult)

Removes the current TestModuleActivity from the ActivityStack.

public static void EndTestModule(TestResult result)

Parameters

result TestResult

The TestResult of the completed test module.

EndTestSuite()

Removes the current TestSuiteActivity from the ActivityStack, with the result calculated from its child items.

public static void EndTestSuite()

EndTestSuite(TestResult)

Removes the current TestSuiteActivity from the ActivityStack and updates its TestResult.

public static void EndTestSuite(TestResult result)

Parameters

result TestResult

The TestResult of the completed test container.

HasTimePlaceholders(string)

Determines whether the specified path contains time-dependent placeholder values.

public static bool HasTimePlaceholders(string path)

Parameters

path string

The path.

Returns

bool

true if the specified path contains time-dependent placeholder values; otherwise, false.

SaveLocalScreenshotBuffer()

Saves all screenshots stored in the local screenshot buffer associated with the current test module activity.

public static void SaveLocalScreenshotBuffer()

Remarks

Note that this only works within an active TestModuleActivity and that only TracingScreenshotCountLocal screenshots are stored in the buffer and are discarded if new report items are added.

SaveReport()

Forces the current report to be saved to the configured file name.

public static void SaveReport()

SetCurrentTestResult(TestResult)

Sets the test result for the currently active test container or test module.

public static void SetCurrentTestResult(TestResult result)

Parameters

result TestResult

The TestResult to set.

SetVideoRecordingProviderFactory(Func<IVideoRecordingProvider>)

Override the default IVideoRecordingProvider to be used with the test report.

public static void SetVideoRecordingProviderFactory(Func<IVideoRecordingProvider> factory)

Parameters

factory Func<IVideoRecordingProvider>

A function returning a IVideoRecordingProvider on demand.

Setup(ReportLevel, string, bool)

Sets up the reporting environment.

public static void Setup(ReportLevel minLevel, string fileName, bool logToConsole)

Parameters

minLevel ReportLevel

The minimum ReportLevel for messages that are to be written to the report.

fileName string

Name of the XML log file, or null if XML logging should be disabled.

logToConsole bool

If set to true, logging to console is enabled.

Setup(ReportLevel, string, bool, bool, Duration)

Sets up the reporting environment.

public static void Setup(ReportLevel minLevel, string fileName, bool logToConsole, bool enableTracingScreenshots, Duration writeInterval)

Parameters

minLevel ReportLevel

The minimum ReportLevel for messages that are to be written to the report.

fileName string

Name of the XML log file, or null if XML logging should be disabled.

logToConsole bool

If set to true, logging to console is enabled.

enableTracingScreenshots bool

Determines whether screenshots should be made for every step. This provides a number of diagnostic screenshots in case of an error.

writeInterval Duration

The time interval for the current report to be saved to the target file.

Setup(ReportLevel, string, bool, bool, Duration, string)

Sets up the reporting environment.

public static void Setup(ReportLevel minLevel, string fileName, bool logToConsole, bool enableTracingScreenshots, Duration writeInterval, string customReportFileLocation)

Parameters

minLevel ReportLevel

The minimum ReportLevel for messages that are to be written to the report.

fileName string

Name of the XML log file, or null if XML logging should be disabled.

logToConsole bool

If set to true, logging to console is enabled.

enableTracingScreenshots bool

Determines whether screenshots should be made for every step. This provides a number of diagnostic screenshots in case of an error.

writeInterval Duration

The time interval for the current report to be saved to the target file.

customReportFileLocation string

Folder containing custom report files.

Setup(ReportLevel, string, bool, string)

Sets up the reporting environment.

public static void Setup(ReportLevel minLevel, string fileName, bool logToConsole, string customReportFileLocation)

Parameters

minLevel ReportLevel

The minimum ReportLevel for messages that are to be written to the report.

fileName string

Name of the XML log file, or null if XML logging should be disabled.

logToConsole bool

If set to true, logging to console is enabled.

customReportFileLocation string

File location for custom reports.