Details
-
Story
-
Status: Closed
-
Major
-
Resolution: Done
-
None
-
None
-
None
-
R3.1.0 S2
-
Description
As a user, I can use result attributes to link a TestNG test to a Test/requirement or to set labels in the Test issue whenever importing TestNG results.
I can link a TestNG test to a Test or a requirement whenever importing the results, if the user sets in the ITestResult object:
- an attribute named "requirement", with the issue key of linked requirement
- an attribute named "test", with the issue key of the associated Test issue
I can add labels to the Test, if the user sets in the ITestResult object:
- an attribute named "labels", with all the wanted labels delimited by space (e.g. "core UI", "core")
Note: these are available as individual "attribute" tags, under the "attributes" tag , under the "test-method" tag.
Example of how to define these values in the Tests code:
@Test public void CanAddNumbers() { Assert.assertEquals(Calculator.Add(1, 1),2); Assert.assertEquals(Calculator.Add(-1, 1),0); ITestResult result = Reporter.getCurrentTestResult(); result.setAttribute("requirement", "CALC-1234"); // Xray will try to create a link to this requirement issue result.setAttribute("test", "CALC-2"); // Xray will try to find this Test issue and report result against it result.setAttribute("labels", "core addition"); // Xray will add this(ese) label(s) to the associated Test issue }
Example of TestNG report: testng-results.xml
Note: instead of changing manualy the value of the ITestResult, this process can be simplified using a custom Annotation.
Attachments
Issue Links
- relates to
-
XRAY-2331 As system, TestNG tests and results can be imported by REST API and from Test Execution issue screen
- Closed