Identify whether an execution needs to be created or whether an existing one can be used

Dominik Rüther November 9, 2020
I need help with a small project i am running.

I have to see if there is a test on a certain date or not. But there should be a version for each day (e.g. November 9, 2020). That’s what I’m supposed to find out with the help of a REST call.

If it is not available, it must be created using a REST call.

Input data:

Date (e.g. November 9th, 2020)

1 answer

1 accepted

0 votes
Answer accepted
Sergio Freire - Xblend
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 10, 2020

HI @Dominik Rüther ,

  1. what do you mean exactly with "see if there is a test on a certain date or not"? If it was created in that date? if it is scheduled to be run on that date? if it was modified on that date? Can you elaborate further please?
  2. "there should be a version for each day" => what do you mean with this exactly? 

 

Regards

Sérgio

Dominik Rüther November 10, 2020

HI @Sergio Freire - Xblend 

1. We have tests every day, and i have to see, if there is already an execution created for a certain day or not. if not, an execution should be created.

2. Since we have tests evry day, during a week, there must also be an execution for each day.

I hope it is a bit more clear now.

 

Regards 

Dominik

Sergio Freire - Xblend
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 11, 2020

@Dominik Rüther ,

perhaps you can try to search for the Test Executions. 

 

You can either use Jira's REST API and JQL for that or use Xray's GraphQL API, which in turn can also receive a JQL.

 

https://xray.cloud.xpand-it.com/doc/graphql/gettestexecutions.doc.html 

 

In the JQL you can search for those issues but the exact query will depend on you you say that the Test Execution is aimed for a given day.

 

Sérgio

Sergio Freire - Xblend
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 11, 2020

@Dominik Rüther ,

perhaps you can try to search for the Test Executions. 

 

You can either use Jira's REST API and JQL for that or use Xray's GraphQL API, which in turn can also receive a JQL.

 

In the JQL you can search for those issues but the exact query will depend on you you say that the Test Execution is aimed for a given day.

 

Sérgio

Dominik Rüther November 11, 2020

Hello Sergio,

 

I found the Problem. Here is the Rest call:

/rest/raven/1.0/api/testplan/{testplankey}/testexecution

 

Thanks for your help.

 

Dominik

Sergio Freire - Xblend
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 11, 2020

Gotcha, so you have a Test Plan and you wanted to find out the Test Executions of that Test Plan :)

All clear now? Do you need anything else?

Regards

Sérgio

Dominik Rüther November 11, 2020

maybe a little thing, how can I create a test and give it different attributes such as the status?

So far I have had this order, but I am not getting anywhere.

POST /rest/raven/1.0/api/testexec/{testExecKey}/test

 

Thank you in advance

Dominik

Sergio Freire - Xblend
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 11, 2020

Well, that endpoint...

POST /rest/raven/1.0/api/testexec/{testExecKey}/test

 

... is to associate existing Tests to an existing Test Execution; it's not to create Tests. 

 

More details here: https://docs.getxray.app/display/XRAY/Test+Executions+-+REST

However, that endpoint is for Xray on-premises (i.e. Jira server/Data Center).. and you are using Xray on Jira Cloud.. or not really?

 

Anyway, if you aim to *create* Tests, you have to use Jira's REST API for that and when doing so, you can define the values for standard fields your issues have.

 

The following open-source repository can be useful as it provides concrete examples of usage of Xray's APIs (for Jira server and for Jira Cloud) and also for Jira's REST API.

https://github.com/Xray-App/xray-postman-collections

 

Hope it helps.

Regards

Sérgio

Dominik Rüther November 18, 2020

Hello Sergio,

thanks again, i figured it out.

But i have two more questions.  I want to find out, with the helf of a REST call, which test cases are in a specific test plan.

I also want to find out, how i ca make a REST cal to attach test cases to a test run.

Would be very nice if you could help me again.

Kind regards

Dominik

Sergio Freire - Xblend
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 18, 2020

Hi @Dominik Rüther ,

I'm not sure if you're using Xray Cloud or Xray on jira premises? Can you please clarify?

Nevertheless, the Postman collections that I shared above provide examples for it.

Regards,

Sérgio

Dominik Rüther November 18, 2020

Hi @Sergio Freire - Xblend 

Thank you, this has been very helpful. I have looked though the collection again and found some calls i need. Unfortunately, I couldn´t find the above-mentioned calls. Do you have an Idea?

I am using Xray on a lokal Server. 

Regards,

Dominik

Sergio Freire - Xblend
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 19, 2020

Hi @Dominik Rüther ,

on your questions:

 

 I want to find out, with the helf of a REST call, which test cases are in a specific test plan.

I also want to find out, how i can make a REST call to attach test cases to a test run.

 

  1. getting the list of tests in a Test Plan
    1. please check https://docs.getxray.app/display/XRAY/Test+Plans+-+REST and use and HTTP GET  /rest/raven/1.0/api/testplan/{testPlanKey}/test  . This is in the Postman collection, under the "test plans" root folder.
  2. A Test Run is an intance of a Test in the context of a Test Execution. Therefore, I guess you want to add Tests to a Test Execution instead. If that's the case, then please check: https://docs.getxray.app/display/XRAY/Test+Executions+-+REST  . It's also in the Postman collection, under the "test executions" root folder.

 

Regards,

Sergio 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events