Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Automated Test Framework (ATF) tests do not rollback the records which have been created / deleted / updated - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Automated Test Framework (ATF) tests do not rollback the records which have been created / deleted / updated
KB0714767

Automated Test Framework (ATF) tests do not rollback the records which have been created / deleted / updated


8945 Views Last updated : Nov 10, 2023 public Copy Permalink English (Original)
  • English (Original)
  • Japanese
KB Summary by Now Assist

Issue

When an Automated Test Framework (ATF) Test is completed, the platform should roll back any record which has been created/deleted/updated. However, there are times when the rollback does not happen.

Cause

There are several scenarios that can cause ATF record not to be rolled back:

  1. Nothing gets rolled back. This might occur when there is a record in the [sys_rollback_context] which is left in the 'In progress' (in_progress) or 'Currently rolling back reverting' (reverting). This prevents the platform from executing any other rollback.

    This screenshot shows list of rollback records that are in progress

  2. Some files aren't rolled back. ATF only tracks records that are inserted/updated/deleted in the same session. If something triggers record operations under another session ID then that operation will not be tracked (Workflows, Scheduled jobs...).

    For example, a custom workflow with a timer object will always run on a worker thread under 'System'. Any records created by this workflow (after the timer) will not be captured in the rollback context, updates made by the test will.
Workflow timer example
 
 
NEW SCENARIO/SYMPTOM:
 
An ATF test triggering or executing a flow might intermittently not roll back data created by the flow if all processes triggered by the flow/subflow is not completed before the test execution ends. There might a async process or a subflow which is not marked to wait for completion which might cause this behavior.

Solution:
Design the flow execution step in such a way that the step waits for the flow and all processes triggered by the flow to complete

Resolution

  1. You must confirm first that the rollback context currently marked as running is not doing anything anymore:

    The workaround is to force the sys_rollback_context state back to "recorded" with a script like the one shown below, which updates the table 'sys_rollback_context' bypassing the ACLs on the UI, where the field "State" on the form is read-only:

    fixContextState();
    function fixContextState() {
    var gr = new GlideRecord('sys_rollback_context');
    gr.get('___SYS_ID_OF_SYS_ROLLBACK_CONTEXT___');
    gr.state = 'recorded';
    gr.update();
    }
  2. As the files are left over after the ATF rollback we can clearly identify the sys_created_by user and logically trace from there. If the record was created by a workflow and this uses a timer then consult with the SM team to determine whether it can be substituted.

The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.