Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Aug 20, 2019 02:22


Download Reporting SDK client for your programming languages and framework

Include DigitalZoom Reporting in Automation

Add the following elements to your automation code to take advantage of Perfecto DigitalZoom Reporting

Adding the basic classes

Declare the Reporting classes

Add the following Using statements to the base test class:

//Reportium required using statements 
using Reportium.test;
using Reportium.test.Result;
using Reportium.client;
using Reportium.model;

Create the reporting client

Use the following snippet as an example of declaring the ReportiumClient instance for your automation script:

const Reporting = require('perfecto-reporting');
public static void beforeClass(TestContext testContextInstance)

   //Initialize Reportium Client
   reportiumClient = CreateReportingClient(mydriver);  // this is an internal method that creates the context and the instance


private static ReportiumClient CreateReportingClient(RemoteWebDriver driver)
	// Create the PerfectoExecutionContext instance to provide the Execution Test Report metadata
	PerfectoExecutionContext perfectoExecutionContext = new PerfectoExecutionContext.PerfectoExecutionContextBuilder()
   return PerfectoClientFactory.createPerfectoReportiumClient(perfectoExecutionContext);

Adding optional functionality

Adding reporting Tags

The reporting tags are added to the Execution context used in creating the instance of the ReportiumClient.

Add Tags, used as a freestyle text for filtering in the Reporting app.
For example: withJob(new Job("Job name", 12345))

Adding CI Job Information

Job information is used to add your test runs to the CI Dashboard. Use the withJob method, supplying the Job Name and Job Number, when creating the ReportiumClient instance.

private static ReportiumClient CreateReportingClient(RemoteWebDriver driver)
   PerfectoExecutionContext perfectoExecutionContext = new PerfectoExecutionContext.PerfectoExecutionContextBuilder()
      .withProject(new Project("My first project", "v1.0")) //optional 
      .withContextTags(new[] { "sample tag1", "sample tag2", "c#" }) //optional 
      .withJob(new Job("Job name", 12345)) //optional 
   return PerfectoClientFactory.createPerfectoReportiumClient(perfectoExecutionContext);

Starting a new test

public void RemoteWebDriverExtendedTest()
   //Starting a test with the following context tags.
   reportiumClient.testStart("MyTestName", new TestContextTags("MyTagName1", "MyTagName2", "MyTagName3"));



Adding test steps

Separate your test into logical steps using the client's testStep() method.

//test step - login to app
reportiumClient.stepStart("Login to application");
WebElement username = driver.FindElement(By.Id("username"));
reportiumClient.stepEnd();  // the message parameter is optional 

Adding assertions to the Execution Report

At various points within a test execution, the script may perform verification of different test conditions. The result of these verification may be added to the Test Report by using the reportingAssertion() method of the ReportiumClient instance. When using this method, the script includes two parameters:

  • A message string - that will be used to label the assertion.
  • A Boolean - indicates the result of the verification operation.
//test step - open a premium account
reportiumClient.stepStart("Open a premium account");
WebElement premiumAccount = driver.FindElement(By.Id("premium-account"));
if (premiumAccount.getText().compareToIgnoreCase("premium")) {
	reportiumClient.reportiumAssert("Check for Premium account", true);;
} else {
	reportiumClient.reportiumAssert("Check for Premium account", false);
reportiumClient.stepEnd(); // the message parameter is optional

Stopping the test


public void afterTest()
      //test success, generates successful reporting 
      if (testContextInstance.CurrentTestOutcome == UnitTestOutcome.Passed)
      //test fail, generates failure repostiung
         reportiumClient.testStop(TestResultFactory.createFailure("TestFailureMessage", null));
   catch (Exception ex)

Getting the report URL

Get the report link by calling the reporting client

public static void classCleanUpMethod()

  // Retrieve the URL of the Single Test Report, can be saved to your execution summary and used to download the report at a later point
	String reportURL = reportiumClient.getReportUrl();
  // For documentation on how to export reporting PDF, see
   	String reportPdfUrl = (String)(driver.Capabilities.GetCapability("reportPdfUrl"));

GitHub Samples




Browse Perfecto GitHub repo for complete C# Reporting samples