In this section:

Sending Test Data to Jira/Xray

The following diagram shows how you could implement an automated infrastructure for integrating Parasoft DTP and Parasoft test execution tools into your Jira environment:

  1. Create tests and/or stories in Jira. The items will be associated with tests executed by Parasoft C/C++test, dotTEST, or Jtest. 
  2. In your test file, add the Jira test or story IDs using the @test or @req annotation. See the C/C++test, dotTEST, or Jtest documentation for details on how to add annotations. 
    • Use the @test <Jira Test ID> annotation to associate tests with test executions in Jira.
    • Use the @req <Jira Story ID> annotation to associate tests with stories in Jira
    • The Jira work item ID is available in several Jira interfaces, such as the URL:
  3. Execute your tests as part of the CI process. You can also manually execute the tests from the IDE.
  4. As part of the test execution, Parasoft test execution tools will tag the results with the filter and build IDs and send the data to DTP. You can verify the results in DTP by adding Test Widgets to your DTP dashboard and setting the filter and build ID. Developers can download the test execution data from DTP into their IDEs so that they can address any failed tests.
  5. If you deployed the Sending Test Data to External System flow (see Deploying the Sending Test Data to External System Flow), then unit and functional testing results will automatically be sent to Jira when Data Collector receives the data from the Parasoft tool. By default, the flow forwards unit and functional test results that were received by Data Collector for any project, but you can configure the flow to only send data for a specific project (see Sending Results from a Specific DTP Project). You can also manually send a POST request to the DTP REST API endpoint in order to send results from the DTP database to Jira (see Manually Sending a POST Request to the DTP REST API Endpoint).

  6. DTP will locate the test results that match the filterId and buildId parameters and send the data to the items in Jira.
    • When DTP locates results with an @test <ID>, it will search for and update tests with a matching ID in Jira. No action will be taken if the IDs do not exist in Jira.
    • When DTP locates results with an @req <ID>, it will search for Jira stories with a matching ID and add test executions to the story. If the ID does not exist, new test executions will be added to Jira. 
    • An external-app.log file will also be written to the <DTP_INSTALL>/logs directory. This log file contains progress information about sending test results from DTP to Jira. 

After DTP processes the report and sends results to Jira, you should expect a response similar to the following:

{
   "createdTestSession": "DTPP-521",
     "created": [
        "DTPP-519, testName = testBagSumAdd"
     ],
     "updated": [
        "DTPP-519, testName = testBagSumAdd",
        "DTPP-518, testName = testBagSimpleAdd"
     ],
     "ignored": [
        "MAGD-567, testName = testBagNegate",
        "QAP-512, testName = testTryThis3",
        "QAP-512, testName = testTryThis4",
        "MAGD-567, testName = testBagMultiply"
     ]
}

Manually Sending a POST Request to the DTP REST API Endpoint 

The Sending Test Data to External System flow shipped with the Traceability Pack will automatically send data from DTP to Jira when new results are collected in DTP (see Deploying the Sending Test Data to External System Flow). Alternatively, you can send a POST request to the DTP REST API endpoint to start this action (refer to syncTestCases Endpoint Reference for details about the endpoint).

Pass the DTP filter and build IDs as URL parameters in the API call:

curl -X POST -u <username>:<password> "http://<host>:<port>/grs/api/v1.7/linkedApps/configurations/1/syncTestCases?filterId=<filterID>&buildId=<buildID>"

The filter and build IDs are available in the Test Explorer URL:

If you are using the Jira Xray traceability report (in addition to, or instead of, the Parasoft traceability report), the test information sent to Jira must include the Fix Version field. By default, the DTP API does not populate the Fix Version field when it creates test execution entities in Jira,
but you can add the fixVersions parameter to your API and specify one or more values to populate the field:

curl -X POST "https://<host>:<port>/grs/api/v1.7/linkedApps/configurations/1/syncTestCases?filterId=<filterID>&buildId=<buildID>&fixVersions=<version1>,<version2>"

You must also first enable the Version field in your Jira project to use the fixVersions parameter. The value of the parameter must match the version specified in your Jira project. In the following example, tests would be updated for fixVersions=1.0

Refer to the Jira documentation for information about configuring versions.

syncTestCases Endpoint Reference

The syncTestCases endpoint sends test data that has been reported to DTP to the integrated ALM system.

Resource/syncTestCases
URL<protocol>://<host>:<port>/grs/api/v1.7/linkedApps/configurations/1/syncTestCases

Method

POST

The following table describes the endpoint parameters.

ParameterValueDescriptionRequired
filterId integerSpecifies the filter ID containing the test data. The filter ID is an integer value and should not be confused with the filter name.Required
buildId stringSpecifies the build ID containing the test data.Required
fixVersions comma-separated list of stringSpecifies a value for populating the Fix Version field in Jira. The Fix Version field is a necessary field for using Jira's traceability reports.   Optional
groupResultsBySOAtestTST boolean

Setting to true groups SOAtest results by .tst file. As a result, one .tst file will be associated with one Xray test.

Setting to false associates each test step within a SOAtest .tst with an Xray test.

Default is false 

See Changing Test Granularity for SOAtest Results for additional information. 

Optional

Changing Test Granularity for SOAtest Results

SOAtest offers the flexibility to implement several testing strategies, such as:

  • creating a limited set of .tst files that contain many test steps,
  • creating many .tst files with a limited number of test steps, or
  • a combination/balance of the above strategies.

By default, each test step in a SOAtest .tst file is associated with an Xray test. This configuration may be too granular for your organization, however, if the functional tests are spread across many .tst files. You can change the default behavior by adding groupResultsBySOAtestTST=true to the syncTestCases endpoint call, for example:

curl -X POST "https://<host>:<port>/grs/api/v1.7/linkedApps/configurations/1/syncTestCases?filterId=<filterID>&buildId=<buildID>&groupResultsBySOAtestTST=true"

If you deployed the Sending Test Data to External Systems flow, you can add the parameter to the linkedApps - syncTestCases node to enable grouping by .tst file:

Sending Results from a Specific DTP Project

If you are using the Sending Test Data to External System flow to forward unit and functional test results, data will be sent to Jira for all DTP projects by default. As a result, work items will be updated to include the tests collected for any DTP project that contain annotations matching Jira IDs. You can configure the flow, however, to only send data for a specific project. 

  1. Open Extension Designer and open the service where the Sending Test Data is deployed.
  2. Double-click the Toggle Projects Mode node and set the value from the dropdown to true. This toggles on the ability to only send data to specific projects.
  3. Click Done.
  4. Double-click the Configure Projects node. The logic in this node specifies which DTP projects should have their data sent to Azure DevOps during the sync operation. These project configurations are stored in a JSON array.
    There is a sample project configuration already defined as an example:

    { project: 'abc' }

    To add more project configurations, add a comma to the end of the last project configuration and add a new entry below it. For example:

    msg.configuredProjects = [
        { project: 'abc' },
        { project: 'foobar' }
    ];
  5. Once the desired projects have been configured, click Done.
  6. Click Deploy to update the flow with these changes.

When the flow executes, only test results for the specified DTP project will be sent to Jira. 

Viewing Results in Jira and Xray

You will be able to view results in Jira after sending the test data. The following image shows a Jira story that contains several tests.

You can click on a test associated with the story to view additional details.

You can also drill into test executions associated with the test.

  • No labels