How to filter all test cases related to user stories which have the labels "a" and "b".

orcanfurkandagli
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!
January 17, 2024

Hello All,

I have user stories which have seperated with labels and I need to filter all test cases linked to the user stories which have labels "a" and "b". Could you help me?

Thanks in advance!

 

3 answers

0 votes
Hannes Obweger - JXL for Jira
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 18, 2024

Hi @orcanfurkandagli,

welcome to the community!

Unfortunately, this is trickier than one might think; as a hierarchical query, it would really require some kind of join or subquery, which isn't available in plain Jira/JQL.

A few directions forward:

  • If it's a one-off thing, you could first query the relevant use story issues, and then use the keys of these issues in a second query, in an "parent in (KEY-1, KEY-2, ...)" clause. (This assumes that your issues are in a parent/child relationship; if they are connected via issue links, you'd use something like "issueLink in (KEY-1, KEY-2, ...)".)

If you want to run your search dynamically, without manually "stitching" two queries together, you'll need extra tooling:

  • You might be able to use Jira Automation to "propagate" parent information down to the child (or linked) issues, and then use the respective field(s) on the child (or linked) issues to include them into your filter. Obviously, this will add a fair bit of complexity to your system.
  • There's different apps from the Atlassian Marketplace that can help with that. First, there's a number of apps that extend JQL by additional functions, including hierarchy-related functions. JQL Search Extensions has been mentioned before, but there's many more.
  • Alternatively, you could try one of the more hierarchy-focused apps from the Marketplace. These apps typically have their own ways of figuring out parent/child or issue link relationships between issues, and provide more powerful ways of searching through issue hierarchies. I myself work on such an app, in which your use case would be easy to solve - I'll provide more details below.

Hope this helps,

Best,

Hannes

Hannes Obweger - JXL for Jira
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 18, 2024

Just to expand on the last point, this is how this would look in the app that my team and I are working on, JXL for Jira. Put simply, you'd create a sheet with all issues that are potentially relevant to you, model your issue hierarchy (that's just a couple of clicks), and then use JXL filtering capabilities to narrow down to the issues that you care about:

epics-by-label.gif

Once you have your list of issues, you can work on these directly in JXL (much like you'd do in e.g. Excel or Google Sheets), trigger various operations in Jira, or export them for further processing.

Any questions just let me know!

0 votes
Charlotte Santos -Appfire-
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.
January 18, 2024

Hi @orcanfurkandagli 

I’m Charlotte, a support engineer at Appfire and I’m here to help you.

Unfortunately, using vanilla JQL, you’ll not be able to do it dynamically.

In the app where my team works, JQL Search Extensions for Jira, you can use this query to find all Test Cases linked to Stories that have labels “a” and “b”: 

issue in linkedIssuesOfQuery("type = story AND labels = a AND labels = b") AND type = "Test Case"

Please contact our support if you have any other questions about this query.

We’ll be happy to help you!

0 votes
Megha Rajanna_EMPYRA
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.
January 18, 2024
 
In Jira, you can use JQL (Jira Query Language) to filter test cases related to user stories with specific labels. If you have user stories labeled with both "a" and "b," you can use the labels field in your JQL query. Here's an example query:
 
JQL
Copy code
issueFunction in linkedIssuesOf("labels = a AND labels = b", "is Test Case of")
This query uses the linkedIssuesOf function to find test cases linked to user stories where the labels are "a" and "b." Here's a breakdown of the query:
 
issueFunction in linkedIssuesOf: This function is used to find issues linked to other issues.
"labels = a AND labels = b": This part specifies the conditions for the linked issues. It looks for user stories with both labels "a" and "b."
"is Test Case of": This part specifies the link type. It looks for issues that are "Test Case of" the identified user stories.
You can enter this query in the Jira Issue Navigator or use it in filters, dashboards, or other places where JQL is supported.
THANK YOU
MEGHA-EMPYRA

Suggest an answer

Log in or Sign up to answer