Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Section


Column

Starting with version 2.0.0, the JMCF add-on comes with a Groovy script editor and tester in the configuration screens of the calculated custom field. This document details the Groovy script tester, its availability and features.

The Groovy script tester tool lets you test your written script against any issue. The main advantage of this tool is that you can quickly test and debug your script and make changes without having to actually save the custom field and recalculate the calculated field value.


Column
width50%


Panel
borderColorsilver
bgColor#f5f5f5
borderWidth1
borderStylesolid

On this page:

Table of Contents



Groovy script tester availability

The Groovy script tester editor in JMCF is available on the Custom field configuration screen when you write a Groovy script to return a value expected by the calculated custom field in the Groovy Formula fieldscreens of calculated custom field types that expect the result of a Groovy script.

Using the Groovy Script tester

After writing your Groovy script in the editor, click on the Test Groovy Script button on the toolbar. A modal dialog window opens, asking you to pick an issue to run the Groovy script against, as well as a linked issue, where applicable. 

...

  • Issue key: start typing an issue key, you will be offered options based on your issue browsing history
  • [Select issue]: if you click on [Select Issue], an Issue selector window gets displayed. You can select the issue either from:
    • Recent Issues: Displays issues that you have recently viewed and first 50 issues from your current search or
    • From Filter: Displays issues of your saved searches.

The issue variable used in your script will point to the above-selected issue. 

...

  1. Message: Success/error message based on the test result.

  2. Result type: Data type of the result.
  3. Result value: Value of the result.
  4. Stack: If an exception was thrown during the execution of the script, a stack trace will be displayed.
  5. Logs: Information logged using the log variable.

Example

Panel

Test a script that returns the sum of two number fields:

  1. Locate the custom field on the Custom Fields administration page.
  2. Click on the cog wheel and click on Configure.
  3. Click on Edit Groovy Formula
  4. In the Groovy editor, write the following lines of code:

    Code Block
    languagegroovy
    linenumberstrue
    issue.get("customfield_10114") + issue.get("customfield_10150")


  5. Click on the Test Groovy Script button on the toolbar.
  6. Type an Issue key.
  7. Click on Test.
  8. The following result is displayed:

...