Last updated: Dec 31, 2018 17:09
Download Reporting SDK client for your programming languages and framework.
DigitalZoom Reporting Authoring
The following code changes are required to include reporting in your test:
The below snippets are a standalone script that does not use any execution testing framework.
Add the following import statement to the test script:
Create an instance of the reporting client
Create an Execution Context (Optional)
The PerfectoExecutionContext instance for your test suite, allows the tester to add some global information that will identify the test suite and allow the user to quickly focus on the test reports for this suite. The Execution Context supports:
- Tags - used as a freestyle text for filtering the reports in the Report Library grid.
- CI Job and Project information - job information is used to add your test runs to the CI Dashboard. The job information includes <Job Name, Branch Name, Job Number> and project information includes <Project Name, Project Version>
- Custom Fields - tags that are <name, value> pairs and can be used to identify and filter your different test runs.
Create an instance of the ReportiumClient used to log test start/step/end events:
Adding Test Information and Steps
Starting a new test
Use the ReportiumClient's test_start() method to start a specific test, and optionally supply a TestContext to add custom fields and tags that will be applied to this particular test, within the test suite.
Adding test steps
Separate your test into actions using test steps.
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 reportiumAssertion() 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.
Stopping the test
When the test is completed - supply an indication of the final outcome of the test by generating a TestResult instance. The TestResultFactory class supports:
- createSuccess method - that notifies the reporting server that the test resulted in a successful status.
- createFailure method - that notifies the reporting server that the test resulted in a unsuccessful status and supports adding a notification message that is displayed in the test report.
- You can also provide a failure reason, or depend on the DigitalZoom smart analysis to identify the failure reason.
In addition to providing the status of the test result, it is possible to provide additional tags and custom fields to the test - this may be used, for example, to add indications of the paths that caused the result or the reason for stopping the test. Use the TestContext to add additional tags and custom fields:
Note: Adding the TestContext to the test_stop is optional.
Getting the report URL
Browse Perfecto GitHub repo for complete Python Reporting samples