If you’re using the Automated Test Framework in ServiceNow, our team has identified some helpful scripts and step setups to accommodate automatic adjustments to date fields and wait times.
This can be used to set the Planed Start Date and Planned End Date each time so you don’t have to update the fields before each run. A use case for this scenario is during ATF setup for a Change Workflow process where the date fields are required to hit a certain time before processing the workflow. (The times show in the scripts are set based on the timezone within the ServiceNow instance).
This screenshot from ATF shows how the script populates the fields:
This can be used to allow for time to pass automatically before triggering the next step in a process. For example, if you needed to insert a wait time for the ATF to wait until a specified time in order for a Change workflow to generate correctly.
For example, when processing a Change workflow, there may be a requirement to wait until the Planned Start date hits a specific time in order for the workflow to kickoff.
A use case for this scenario is setting the Planned Start time to 5 minutes in the future on a Change record. Following the below steps forces the ATF to wait until the Planned Start hits, then it will continue with testing the workflow.
Example of the step setup within ATF: