Skip to main content

How to report attributes to ReportPortal

Attributes are essential for categorizing, filtering, and analyzing test data. This article will guide you through the process of reporting attributes to our test results reporting service.

Be sure to check out our dedicated article for best practices on using attributes effectively.

Parameters of attributes

  • Format – Key : Value
  • Key – any string value, optional field
  • Value – any string value, mandatory field
  • The maximum limit is 512 symbols each for both key and value

Multiple values can be associated with a single key. For example, if we have a jira_id key, the value can differ based on the Jira ticket.

important

The only valid use of the colon is to split the key and value.
When a colon is present in the key or in the value, it breaks the string into two parts.

Colon scenarios

1. Key and value reported, colon used in key only.

Example:
{"key": "la:bel", "value": "smoke"}

Behavior on UI:
Key: la
Value: bel

The original value "smoke" is not transmitted at all.

2. Key and value reported, colon used in both key and value.

Example:
{"key": "la:bel", "value": "smo:ke"}

Behavior on UI:
Key: la
Value: bel

The original value "smoke" is not transmitted at all.

3. Key and value reported, colon used in value only.

Example:
{"key": "label", "value": "smo:ke"}

Behavior on UI:
Key: label
Value: smo

The value is truncated at the colon, and only the part before the colon is transmitted.

4. Value reported, colon used in value only.

Example:
{"value": "smo:ke"}

Behavior on UI:
Value: smo

The value is truncated at the colon, and only the part before the colon is transmitted.

Adding attributes via test framework integration

JavaScript

Here is an example of adding attributes for a Playwright agent.

You can add attributes for the Launch in ReportPortal agent config:

You can add attributes for the test item in your test file:

.NET

Attributes in .NET agents can be added declaratively or at runtime. To add launch attributes via standard ReportPortal.json config file:

{
"launch": {
"attributes": ["platform:unix", "arch:x64" ]
}
}

And to add test attributes (sample for NUnit):

[Test, Category("browser:chrome")]
public void Test1()
{
ReportPortal.Shared.Context.Current.Metadata.Attributes.Add("browser", "chrome");
}

In Gherkin:

@browser:chrome
Scenario: Scenario1

Adding attributes via API

You can initiate (launch, suite, test, or step) with one set of attributes and finish with a different set.

Importantly, the new attributes do not overwrite the old ones; instead, they are added.

System attributes

In the ReportPortal, there is an opportunity to influence specific processes and data processing rules. To this end, ReportPortal supports system attributes. These attributes can be applied to the selected test items and trigger ReportPortal to take certain actions. System attributes are not visible on the UI (for that, the attribute should be sent with system: true).

immediateAutoAnalysis

If immediateAutoAnalysis=true, then each test item will be analyzed right after it is completed, without waiting for the whole launch to finish.

immediatePatternAnalysis

When immediatePatternAnalysis=true, then each test item will be analyzed right after it is completed, without waiting for the whole launch to finish.

skippedIsNotIssue

If skippedIsNotIssue=true during launch import, then all test items with the SKIPPED status will be processed without applying a To Investigate defect type.