Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For the Travis CI the important change we must do is in the YAML file that will configure Travis CI pipeline, we use the following configuration to achieve that:

Code Block
languageyml
title.travis.yml
sudo: false

...


language: java

...


jdk:

...


  - openjdk8

...


cache:

...


  directories:

...


  - "$HOME/.cache"

...


  
jobs:

...


  include:

...


    - stage: test and report to

...

 Xray
      script:
        - |
            echo "building repo..."

...


            mvn clean compile test --file pom.xml

...


            curl -H "Content-Type:

...

 multipart/form-data" -X POST

...

 -u $USERNAME:$PASSWORD -F "file=@target/surefire-reports/TEST-com.xpand.java.CalcTest.

...

xml" "https://

...

$JIRASERVER/rest/raven/2.0/import/execution/junit?projectKey=$PROJECTKEY&testPlanKey=$TESTPLAN"

...


            echo "done"


For more details about this configuration please check the TravisCI tutorial documentation.

As you can see we are pushing results back to Xray with the last curl command::

Code Block
languageyml
titlecurl command
curl -H "Content-Type:

...

 multipart/form-data" -X POST -u $USERNAME:$PASSWORD -F "file=@target/surefire-reports/TEST-com.xpand.java.CalcTest.

...

xml" "https://

...

$JIRASERVER/rest/raven/2.0/import/execution/junit?projectKey=$PROJECTKEY&testPlanKey=$TESTPLAN"


On this command we are passing the project key in order to report back to a specific Project on the Xray side. Further ahead we will show how it is populated.

  • PROJECTKEY - The key that identifies the project on the Jira side.
  • TESTPLAN - The Test Plan key used to identify the Test Plan to associate the execution with.

...

After publishing the rule, you can go to the screen of an issue and trigger the Jenkins TravisCI project/job.



In this case, since Jenkins TravicCI was configured to report results back to Xray, a new Test Execution would be created in Jira/Xray.

...