Opsera Insights : KPI : Unit Tests through Sonar
Scope:
The scope of this documentation is to demonstrate on how to use the Unit Test KPI to measure each Unit Tests that run through Command Line step in Opsera Pipelines. Important to note that this KPI works only for Command Line steps that have the Sonar scan enabled, and configured right.
Â
Section 1: Applying tags to a pipeline
Go to the pipeline which runs the command line with sonar scan enabled.
In Summary Tab of the pipeline, apply relevant tags to the Tags field.
This step is an optional step. However, adding tags allow users to slice and dice data while using Opsera Insights
Section 2: Create a Dashboard
Navigate to Insights → Dashboards.
Click on ‘New Dashboard’ and provide a name.
If you have already created a dashboard, you may skip this step, and proceed to Section 3.
Section 3: Add Sonar Unit Test KPI to the Dashboard
Open the Dashboard created in Section 2, or any existing Dashboard.
Click on '+' to add a KPI to the dashboard.
In Marketplace, search for ‘Unit’ in the Search bar.
From the list of KPIs, select ‘Unit Test with metrics from Sonar’.
If required, you may explore the Marketplace and add more KPIs to the Dashboard.
Once done, navigate back to the working Dashboard. You will start seeing data as and when you run similar pipelines mentioned in the Description.
Section 4: How to use KPI Settings
Each KPI added from the Marketplace has its own set of Configurations.
Click on the Settings gear at the top right corner of the KPI. The KPI opens up to an overlay with various options.
This KPI allows users to set KPI level tags. Users can apply the tag created in Section 1 at the KPI level, as shown below.
If and when you have multiple Pipelines and Projects running Unit Tests through similar Command Line steps with Sonar enabled, tags can be used to slice the results to display what users need.
Users can also set ‘Date Ranges’ to see results within a certain period of time.
Â