Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Scriptrunner remote Spock test failing due to java.lang.Exception


Hey there,

i am using Scriptrunner restendpoints, which i want to unittest using the Spockframework  as described here: [Adaptavist] Testing your Code 

Putting the tests into the scriptroot and then executing it via the ui works like a charme.


When trying to run them from IntelliJ i always stumble into the following exception:

 java.lang.Exception: No tests found matching method name filter from org.junit.runner.Request$1@3af039ed

at org.junit.internal.requests.FilterRequest.getRunner(
at org.junit.runner.JUnitCore$run$ Source)
at com.onresolve.scriptrunner.canned.common.admin.RunUnitTests.doScript(RunUnitTests.groovy:320)

Anyone can help me resolving that issue?


IntelliJ Configuration:2018-03-01 17_47_19-Run - ChangeLanguageTest.png


package X.X.X

import com.atlassian.core.user.preferences.Preferences
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.preferences.UserPreferencesManager
import com.onresolve.scriptrunner.canned.common.admin.ScriptRunnerTestRunner
import com.onresolve.scriptrunner.canned.common.admin.SrSpecification
import org.junit.runner.RunWith

class ChangeLanguageTest extends SrSpecification {

def "Process"() {

setup: "create temporarily user and generate test data"

final String locale
// Check if DefaultUserLocale is de_DE. If switch locale to en_US, so that the test will still work
if (ComponentAccessor.applicationProperties.defaultLocale.toString() == "de_DE"){
locale ="en_US"
else {
locale ="de_DE"
//Create test user
final String username = "changeLanguageTestUser"

ComponentAccessor.userUtil.createUserNoNotification(username,"",username +"",username)

//Generate userLanguageJSON
final String userLanguageJson = "{\n" +
" \"language\": [{\n" +
" \"username\": \"" + username + "\",\n" +
" \"language\": \"" +locale + "\"" +
" }]\n" +
" }"

when: "instantiating changeLanguage and executing process"

new LanguageChanger(userLanguageJson).process()

then: "users locale should be de_DE"

final ApplicationUser user = ComponentAccessor.userManager.getUserByName(username)
final Preferences userPreferences = ((UserPreferencesManager) ComponentAccessor.getOSGiComponentInstanceOfType(UserPreferencesManager.class)).getPreferences(user)
final String currentLanguageLocale = userPreferences.getString("jira.user.locale")
currentLanguageLocale == locale

cleanup: "delete all test artifacts"
//Jira does not remove the locale after deleting the user (seems that it is somehow bound to the username)
// that means that it is necessary to delete the userPreference "jira.user.locale" manually, so that a default will be set again.
ComponentAccessor.userUtil.removeUser(ComponentAccessor.jiraAuthenticationContext.loggedInUser, user)


1 answer

having the same issue too

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

How we use Jira Service Management for our recruitment process! - Part 2

It is never about setting up a process and being done with it. Rather, the focus should always be on optimizing it for the best outcomes. Thus, we didn’t stop at setting up JSM for our recruitment pr...

182 views 0 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you