Uploaded image for project: 'Xray for Jira'
  1. Xray for Jira
  2. XRAY-2411

As a user, I can use result attributes to link a TestNG test to a Test/requirement or to set labels whenever importing results

    XporterXMLWordPrintable

Details

    • Story
    • Status: Closed
    • Major
    • Resolution: Done
    • None
    • R3.1.0
    • None
    • None
    • R3.1.0 S2
    • OK

    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

          Activity

            People

              pmmr Pedro Rodrigues
              smsf Sergio Freire
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 days, 20 minutes
                  4d 20m