Forums

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

Track usage of a test case

Daniela Soto
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!
April 15, 2020

Hi all! 

Quick question: innTM4J is there any way to track the usage of a test case? I want to see all the places where a test case is called with the call to action functionality.

 

Thanks in advance!

Dani

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Nic Brough -Adaptavist-
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 Champions.
May 28, 2022

This is a script which is generally useless because it's a composite example - it shows you how to set a value of every type of standard custom field.

You should be able to extract the bits that refer to multi-selects quite easily

https://library.adaptavist.com/entity/update-the-value-of-custom-fields-through-the-script-console

Rodolfo So
May 30, 2022

Hi @Nic Brough -Adaptavist- 

 

I've already tried that one but I'm not sure how to pass the variable to select option.

 

 

Here's my Scriptrunner mail handler script

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.service.util.ServiceUtils
import com.atlassian.jira.service.util.handler.MessageUserProcessor
import com.atlassian.mail.MailUtils
import com.atlassian.jira.user.ApplicationUser
//This requires the name of the user that will trigger the Mail Handler
final def username = 'testuser'

//This requires the Project's Key that will be used for the Mail Handler
final def projectKey = 'EA'

//This requires the name of the Issue Type that will be used
final def issueTypeName = 'Story'


def userManager = ComponentAccessor.userManager
def projectManager = ComponentAccessor.projectManager
def issueManager = ComponentAccessor.issueManager
def issueFactory = ComponentAccessor.issueFactory
def messageUserProcessor = ComponentAccessor.getComponent(MessageUserProcessor)
def customFieldManager = ComponentAccessor.customFieldManager
def optionsManager = ComponentAccessor.optionsManager

def user = userManager.getUserByName(username)
//def issueReporter = messageUserProcessor.getAuthorFromSender(message) ?: user
ApplicationUser reporter = messageUserProcessor.getAuthorFromSender(message) ?: user
def project = projectManager.getProjectObjByKey(projectKey)
def subject = message.subject as String
def messageBody = MailUtils.getBody(message)


def cfVertical = customFieldManager.getCustomFieldObjectsByName('Vertical').first()

def issue = ServiceUtils.findIssueObjectInString(subject) as MutableIssue

if (issue) {
return
}

def issueObject = issueFactory.issue
issueObject.setProjectObject(project)
issueObject.setSummary(subject)
issueObject.setIssueTypeId(project.issueTypes.find { it.name == issueTypeName }.id)
issueObject.setReporter(reporter)

//vertical
def regex = /(?<=\[\[)([^\[\]]*)(?=\]\])/
def emailMatch = (MailUtils.getBody(message) =~ regex).findAll().first() as List
def VerticalEmail = emailMatch.first() as String

//issueObject.setDescription(MailUtils.getBody(message))
issueObject.setDescription(VerticalEmail)
issue = messageHandlerContext.createIssue(user, issueObject) as MutableIssue

 

def fieldConfig = cfVertical.getRelevantConfig(issue)
def options = optionsManager.getOptions(fieldConfig)
def option = options.findAll { it.value in [VerticalEmail] }

issue.setCustomFieldValue(cfVertical, option)

issueManager.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH,false)

TAGS
AUG Leaders

Atlassian Community Events