Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Why won't ScriptRunner unit tests run in Jira

Edited

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>(ModuleCompleteKey.java:49)
at com.atlassian.plugin.ModuleCompleteKey.<init>(ModuleCompleteKey.java:29)
at com.atlassian.plugin.manager.ProductPluginAccessorBase.getEnabledPluginModule(ProductPluginAccessorBase.java:176)
at com.atlassian.plugin.manager.ForwardingPluginAccessor.getEnabledPluginModule(ForwardingPluginAccessor.java:52)
at com.atlassian.plugin.manager.EnabledModuleCachingPluginAccessor.getEnabledPluginModule(EnabledModuleCachingPluginAccessor.java:35)
at com.atlassian.plugin.manager.ForwardingPluginAccessor.getEnabledPluginModule(ForwardingPluginAccessor.java:52)
at com.atlassian.plugin.manager.ProductPluginAccessor.getEnabledPluginModule(ProductPluginAccessor.java:18)
at com.atlassian.jira.plugin.customfield.CustomFieldTypeModuleDescriptorsImpl.getCustomFieldType(CustomFieldTypeModuleDescriptorsImpl.java:51)
at com.atlassian.jira.issue.managers.CachingCustomFieldManager.getCustomFieldType(CachingCustomFieldManager.java:206)
at com.onresolve.scriptrunner.test.CustomFieldCreationInfo$Builder.setCustomFieldTypeKey(CustomFieldCreationInfo.groovy:176)
at it.com.adaptavist.TestingEnvironmentFieldIT.setup(TestingEnvironmentFieldIT.groovy:58)

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()
.setName("Environments")
.setCustomFieldTypeKey("Select List (multiple choices)")
.setSearcherKey(ScriptRunnerImpl.PLUGIN_KEY + ":multiuserpickersearcher")
.setTestProjectContext()
.build()
...
}

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

Suggest an answer

Log in or Sign up to answer
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.

TAGS
AUG Leaders

Atlassian Community Events