Rollback ATF at last test suite

Nguyen Dai
Tera Contributor

Hi everyone,

My flow ATF has about 80 test steps, I want to break it to 4 big test, each test has 20 test step

I break ATF to 4 Test Suites but after run test suite 1 data is rollback, it's not run to next test suite.

I have question, can I run all test suite and rollback after last step ?

Or can you suggest to break test steps.

Thanks

5 REPLIES 5

Amit Gujarathi
Giga Sage
Giga Sage

Hi @Nguyen Dai ,
I trust you are doing fine.

To break down your ATF flow into smaller test suites, you can follow the steps below:

  1. Navigate to the Test Suite tab in your ATF flow.
  2. Click on the "Create New" button to create a new test suite.
  3. Add the first 20 test steps to the new test suite and save it.
  4. Repeat steps 2 and 3 until you have created 4 test suites, each containing 20 test steps.

Now that you have broken down your ATF flow into 4 test suites, you can run them in sequence. However, by default, ATF rolls back all changes made during a test run to ensure a clean state for the next test. This means that after running test suite 1, any changes made to the system during the test run will be rolled back, and the system will be returned to its original state.

To run all test suites and rollback after the last step, you can add a final step to your last test suite that rolls back all changes made during the entire test run. To do this, you can add the following code to the final step of your last test suite:

var gr = new GlideRecord('sys_transaction');
gr.addQuery('state', 'pending');
gr.query();
while (gr.next()) {
  new GlideTransaction(gr.getUniqueValue()).rollback();
}

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Thanks for answer the question. I will try config it

sorry, can you check again script.

I can not find table 'sys_transaction' ?

@Amit Gujarathi Still, the rollback would happen at the end of each test right. Either we should disable rollback for the table under testing, and add the script step which would do the roll back at the end.

Or Do you have any other recommendations?