Testing scripts against an existing object

You can test your script against an existing object. For example, if the script’s object type is Milestone, you run the script against a milestone within an incident.

When you test a script, you are prompted to enter a valid ID. For the email message object type, you are prompted for an email message ID. You can find the ID on the Mail Inbox page, which you can access by clicking Inbox in the menu. For any other object type, you must enter a valid incident ID. You can find the ID by opening an individual incident or scenario. The ID is in the Summary section of the page.

Important: A script can cause changes to the data. When you test your script and you are not in a development environment, you can use a simulated incident ID to run your script against simulations and not open incidents. For email messages, you can create a test email, which you can do by sending an email to the account configured in the inbound mailbox. For more information, see Changed in 51.0.2.0 Configuring an inbound email connection in the System Administrator Guide.

Test your script as follows.

  1. Click Run.
  2. When prompted for an incident or email message ID, enter a valid ID.
  3. Select an object within the incident. Only those objects of the type assigned to the script are shown.
  4. Click Finish.

The script runs and a console window shows with the results. It is slightly transparent so that underlying content can be visible.

To view information at specific points in the script, make sure to include in the script the log info method described in the previous table, as shown in the following example.

log.info("The value of x is {}".format(x))

Log messages are the last set of information that is reported after each run. You can filter the log messages by changing the Log Level choice in the Console Window header area.

Because the system is designed to run concise scripts, “stepping-through” the code is not available.

If you make changes, you can rerun the script using the same incident and object by clicking Run Again. You do not need to save the script to run the script again.

Note: It is important to test your scripts fully to verify that the results are as expected. The SOAR Platform cannot fully verify script logic.