Versions Compared

Key

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

...

There are several ways to automate tests and link them to the steps in Boozang but in however for this section, we will focus on one. For other options more suited to your requirements, we suggest taking a look at Boozang's documentation. 

...

Once the Modules and Tests are ready we , they'll need to link those be linked to each Step in the Cucumber Test, for that we need to go into . In order to achieve this, access the details of each Cucumber Test and click in the on "NOT IMPLEMENTED! -..." steps, that   which will load , in the upper part of the application, in under the Main submenu of the "Action Setting" tab.C

Clicking Click on the "Goto Go to Test" entry we will have the possibility to choose, from the dropdown list, which Test will be associated to this step .via a dropdown available which a list of tests to choose from:


The final result looks will look like the following screenshot, where all the steps have automated tests Tests associated and are ready to be executed.

...

Tip
iconfalse

Once you have associated all the steps, you can validate that everything is running as expected by clicking in on the Play button, this . This option will execute the test and report the results back.

When executing the Tests, Boozang will open up a new browser window where you can follow the Test execution and report back to the Test window.

...

Import results to Xray

Finally, the Tests we which have been exported from Xray into Boozang are automated and now we need the .  The results from the executions to  have to be sent pushed back to Xray, to do that we will use the CI part of the Boozang tool, in this are we will be able into Xray. This can be achieved via Boozang's CI where the ability to generate the necessary scripts , for different CI/CD tools , that will execute the Boozang Test Runner is available. 

In Boozang, access the CI entry present in at the bottom of the left menu.


Jenkins

In our casethis example, and to take advantage of the Xray Jenkins Plugin available, we generate the script needed to include in Jenkins was generated by clicking the bottom link "Get Jenkins config".

A new pop-up will appear requiring details to generate the script


The majority of the options will be the default ones, we are going to choose the let's choose "Test case" to be the feature we have automated (in from the drop-down list)


Fill in the password, click "Submit," and click on "Generate." , this This will produce the necessary script that we will copy be copied and paste pasted into Jenkins.


In Jenkins, we created a simple Project where we add one step an additional step was added to insert the script generated, more . More specifically by adding a an "Execute shell" in the build step section and inserting the generated code there


Tip
iconfalse
titleTip

If you have defined several Tests, the output of the execution will generate one report per Test, so in . In order to upload the results, the results we need to merge those results into one report, this be merged into a single report. This can be achieved by using a tool that will merge two Cucumber reports into one.

You can find that use this tool here, the usage is simple:

Code Block
languagebash
themeDJango
cucumber-json-merge-multiworker report_cucumber-m3-t1.json report_cucumber-m3-t2.json


After the execution, you can find the report in the default output file "merged-test-results.json" or specify the name of the output in the parameter "-o".


The last step, before executing the pipeline, is to add the Xray Plugin to import the results back to into Xray. First, to do so make sure you have previously installed the plugin, and  and in your pipeline you , just need to add in the Post Build Actions , the "Xray: Results Import Task" and configure properly with:

  • the Jira/Xray instance that you will use to upload the results
  • the Format of the results file you want to import, in our this case, Cucumber JSON
  • The path and name of the file to be uploaded


Once you build this pipeline is built, it will execute the tests in Boozang and import the results into Xray as you can verify in the "Console Output" of the build:

...

We can see the response from Xray , where we can find the Test Execution created for this execution.

...

Tip
iconfalse

If you want to see view the results in Jenkins, install the Cucumber Reports Plugin that will automatically process and generate a view in Jenkins for you to check go over the results.


In Xray, if If we verify the Test Execution that was created we can see in Xray, the uploaded results with the total number of Tests and the Overall Execution Status (is available -  in this case, it's not really relevant because we only have relevant since there is one Test but if we had there were several Tests it will be the overall result of all the Tests).


To have Clicking on the Details button (below the red arrow) will give users a better understanding of the details characteristics of the execution we can press the details button (one below the red arrow) that will take us to since it navigates the execution panel of the Test Execution , in there we can see the details of the executionwith the following information:

  • The requirement that is covered by the Test, in this case, XT-5
  • The scenario definition
  • The details of the execution of each step

...

If Jenkins (or another CI/CD tool) is not part of your workflow, you can use the Xray API to send import the result back to into Xray through the command line, to . To do so you must take two , please follow the next steps:

  • Authenticate to obtain the token
  • Send the results to Xray ( using the token obtained)


Authenticate 

In order for you to authenticate you will need to get your You can start the authentication process by accessing your ClientID and Client Secret from your Jira/Xray cloud (more information here) and then use the following command to obtain the token:

...

This will return a token that you must save to use in the following requests.

Send results to Xray

Finally to upload the results back into Xray , you must enable the above token in the following request in order to upload the results back into Xray:

Code Block
languagebash
themeDJango
curl -H "Content-Type: application/json" -X POST -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpfvsJ9...EmSHPTxO2NXBDGlSn5qfoydMKW7oncRvrzbV6e26fU0"  --data @‘xrayResults.json’ ‘https://xray.cloud.xpand-it.com/api/v2/import/execution'


When successful, the answer will have information of the Test Execution created, like the following one that you can use to check for in Xray:

Code Block
languagebash
themeDJango
{"id":"10268","key":"XT-237","self":"https://xraytutorials.atlassian.net/rest/api/2/issue/10268"}


In Xray we We can see the detailed results in Xray:

Learn more

...