Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Why won't ScriptRunner unit tests run in Jira


I'm getting set up for the first time with a repo to contain all of my ScriptRunner scripts, and I'm having trouble running a simple unit test I wrote to validate a custom field script. I'm using a copy of the sample project, and I followed the instructions for setting up IntelliJ, but when I run the test either in IntelliJ or in the local Jira environment (Built In Test Runner script), I'm getting this error:

Process finished with exit code 255

java.lang.Exception: Invalid module key specified:

at com.atlassian.plugin.ModuleCompleteKey.<init>(
at com.atlassian.plugin.ModuleCompleteKey.<init>(
at com.atlassian.plugin.manager.ProductPluginAccessorBase.getEnabledPluginModule(
at com.atlassian.plugin.manager.ForwardingPluginAccessor.getEnabledPluginModule(
at com.atlassian.plugin.manager.EnabledModuleCachingPluginAccessor.getEnabledPluginModule(
at com.atlassian.plugin.manager.ForwardingPluginAccessor.getEnabledPluginModule(
at com.atlassian.plugin.manager.ProductPluginAccessor.getEnabledPluginModule(
at com.atlassian.jira.plugin.customfield.CustomFieldTypeModuleDescriptorsImpl.getCustomFieldType(
at com.atlassian.jira.issue.managers.CachingCustomFieldManager.getCustomFieldType(
at com.onresolve.scriptrunner.test.CustomFieldCreationInfo$Builder.setCustomFieldTypeKey(CustomFieldCreationInfo.groovy:176)

I'm creating a custom field in my setup, because my script field being tested refers to it. This is the code that creates the custom field, with the first ("def") line (58) reporting the exception:

def setup() {
def environmentsFieldCreation = CustomFieldCreationInfo.Builder.newBuilder()
.setCustomFieldTypeKey("Select List (multiple choices)")
.setSearcherKey(ScriptRunnerImpl.PLUGIN_KEY + ":multiuserpickersearcher")

I have a feeling it's related to the setCustomFieldTypeKey or setSearcherKey calls having bad values, but I can't find any documentation for them. What should I pass to them?

1 answer

1 accepted

0 votes
Answer accepted

It turned out the error message didn't have much to do with the error, which was that I was using invalid values in setCustomFieldTypeKey and possibly the other calls after newBuilder(). The most important part of the error was the beginning few lines of the stack trace.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira Service Management

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

340 views 0 10
Join discussion

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