Test mode offers basic debugging functionality where you can test the results of a script by entering values to test as input to the script.
Be aware that depending on the contents of a script, sometimes a script can fail upon testing but still run successfully when deployed and executed on an agent. This may happen if, for example, you do not have a default value set for a global variable that obtains its value upon running.
The script used for testing has a size limitation of 51200 bytes. This limit does not apply beyond testing.
In Jitterbit Scripts, you can use the function
DebugBreak, which acts as a breakpoint for the script execution. When a script is tested, the Jitterbit Script engine stops execution when it reaches a call to
DebugBreak. It sends back information about the current state to the client, including the values of all data elements, both source data elements and global data elements. This provides a powerful way to test the logic you put in the script.
DebugBreak optionally accepts a
boolean value. If true, execution will break at the statement when testing. If false, the breakpoint will be ignored when testing. This allows you to set up sophisticated testing scenarios that are controlled by input variables, allowing you to test parts of a script depending on settings. For more information on how to use
DebugBreak, see Debugging Functions.
Running a Test
Within a script, use the toggle in the top right to select Test mode:
Then click the Test button to run a test:
When running a test, this information is displayed in the table:
- Value: The current value of the script variable. When the script is not running, you can edit the value of a variable.
- Set Null: When the script is not running, you can use this flag to set the value to null.
When a test is started or resumed, any new values are sent back to the script engine.
You can walk through the debugging process using the controls along the top of the table:
|Resume: When the test is stopped, clicking this button resumes the test. The test will run until it either comes to another breakpoint or until it has completed.|
|Next: When the test is stopped, clicking this button runs only the next statement of the script. This allows you to step through the script line by line.|
|Stop: This stops the current test.|
You also have the option to toggle off breakpoints. Select the checkbox to Disable Breakpoint if you want the test to ignore all calls to
DebugBreak and instead run to completion. This option is applicable for Jitterbit Scripts only.
To search for a particular variable by name, use the search box to enter a keyword or multiple keywords separated by commas. Variables that have any part of the keywords in the variable name will be returned.
To reset all values, click the Reset Values link below the table.
Finally, the Result is shown in second table that appears below the first:
- Jitterbit Script: The Result table displays the resulting output of the last statement of the script (if no breakpoints are present), or the resulting output after each breakpoint.
In addition, any error messages incurred during the testing are also displayed.
Last updated: Jan 29, 2020
- No labels