Forums

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

Scriptrunner test runner transition issues

Jakub Cieplinski
Contributor
May 11, 2022

I've been making tests for our scriptrunner scripts using it's built in testing functionality. However there seem to be an isuse if a script is i'm testing is changing the issue assignee. In the "then" section, issue assignee still reports as the previous one before change. Is it something I'm doing, is it flaw in testing tool?

def 'Test issue_pf_assign_to_Anton'() {
given: "..."
// some vars needed for issue creation
def issue = createIssue(sourceCity, destinationCity, beginDate, endDate, 'Test', '', reporter)
def tOptions = new TransitionOptions.Builder().build()
def inputParameters = is.newIssueInputParameters().with {
//some input params
return it
}
def transition1 = 81
def transition2 = 241

when: ".."
def transitionVal = is.validateTransition(issue.assignee, issue.id, transition1, inputParameters, tOptions)
is.transition(currentUser, transitionVal)
issue.setAssignee(reporter)
ComponentAccessor.issueManager.updateIssue(issue.assignee, issue, EventDispatchOption.DO_NOT_DISPATCH, false)
transitionVal = is.validateTransition(issue.assignee, issue.id, transition2, inputParameters, tOptions)
is.transition(currentUser, transitionVal)

then: ".."
issue.assigneeUser.name == 'correctUser'
}

Transition1 is just intermediary, needed to trigger transition2

Transition2 is setting assignee to correct one(functionality i want to test)

In 'then' section, the assignee is still the reporter instead of a new one. But if i go in Jira to ticket created with this test, assignee is the one I'm expecting it to be. How come? 

0 answers

Suggest an answer

Log in or Sign up to answer