Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to query stories which have no test or have tests not in an 'approved' status

Hadas Hamerovv
Contributor
February 27, 2022

Hi,

I wish to get all the stories which are not linked as 'parents' to issue of a 'test' type or linked to 'test' but those 'test' are not in the 'approved' status.

Can someone help with this?

 

Naturally I want only the stories in the current sprint but this i believe I know how to add.

 

Thanks 

2 answers

0 votes
Pete Singleton
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.
October 19, 2022

I was looking for the same query, Stories not linked to Tests... the following seems to work (although it is slow!)

 

IssueType = Story AND issue NOT IN linkedIssuesFromQuery("IssueType = Test")

 

You can expand the query to include Sprint ID and/or the Test status, e.g

IssueType = Story AND Sprint = 123 AND issue NOT IN linkedIssuesFromQuery("IssueType = Test AND Status !=Approved")
0 votes
Benjamin
Community Champion
February 27, 2022

HI @Hadas Hamerovv ,

Assuming you are using scriptRunner Enhanced search based on the tag on this post.

 

You can use linkedIssuesOf function:

https://scriptrunner-docs.connect.adaptavist.com/jiracloud/enhanced-search.html

linkedIssuesOf(Subquery, [link name])
For example,

issueFunction in linkedIssuesOf("status NOT IN Approve", "blocks") and IssueType=Story

 

The above is just example of what you can accomplish. Just modify it to your needs. Also, added a link to the documentation.

 

Thanks,

 

Ben 

Hadas Hamerovv
Contributor
February 27, 2022

I tried this but I could not figure how to add the part for 'or there are no tests linked at all'

Benjamin
Community Champion
February 27, 2022

HI @Hadas Hamerovv ,

 

There's a few example in the post that will help find issues with no link.

 

https://community.atlassian.com/t5/Jira-questions/Get-all-Issues-without-linked-issue/qaq-p/629810

If you have a particular link type for linking to test, there's another option to search for link type. 

 

-Ben

Hadas Hamerovv
Contributor
February 27, 2022

I started with that thread. The problem is that there might be linked issues only not from the 'test' type. (Therefore the issueLinkType is EMPTY won't fit here.)

Again: I wish to find 'stories' with no 'tests' linked to them or with tests linked and not in the 'approved' status. 

Benjamin
Community Champion
February 27, 2022

Have you consider in combining them?

 

(IssueType=Story and IssueLinkType is Empty) 

(IssueType=Story and issueFunction in linkedIssuesOf(Type=Test)) OR (JQL for your other search)
Hadas Hamerovv
Contributor
February 27, 2022

yes but issueLinkType might not be Empty as there are other 'stories' or 'issues' 'tasks' 'bugs' linked to the story while no 'tests' are linked.

So I am still missing the stories which have no 'tests' linked to them but are linked to 'other' issues.

Benjamin
Community Champion
February 27, 2022

This is JQL should cover that case:

 

IssueType=Story and IssueLinkType is not Empty

Hadas Hamerovv
Contributor
February 27, 2022

Sorry but no. I need a case that there are no 'tests' linked to the issue. The query you offer suggest that no issue of any type is linked. That is not the case.

Benjamin
Community Champion
February 27, 2022
(IssueType=Story and issueFunction in linkedIssuesOf(Type NOT IN Test)

This query will query all stories the have link to issues other than test.

Hadas Hamerovv
Contributor
February 27, 2022

Sorry, This results in 'stories' that are linked to other issues regardless if they are linked to 'tests' or not.

I want only stories that are not linked to 'tests' regardless if they are linked to other issues or not.

Hadas Hamerovv
Contributor
February 27, 2022

I was happy too early. Sorry.

Emily Hansel July 10, 2023

@Hadas Hamerovv did you ever get an answer to this? I'm trying to do the same thing as you but am struggling with it

Manjiri Godale
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 6, 2023

@Hadas Hamerovv  Try below condition in your query. It works 

type in (Story) AND IssueLinkType in (Test) 

Suggest an answer

Log in or Sign up to answer