ATF record update test step is not updating record but is also not failing

chrisf
Kilo Expert

My update record test step is failing to update the record but it is also not failing the test.

I have tried updating a record a couple different ways. 

First, I used a Record Update test step and ran it by itself and updating an existing record.  The test indicates that it runs successfully, however, when I go and check in the table, none of the fields I have chosen have changed. 

Second, I used a Run Server Side Script and the following code in the step:

var gr = new GlideRecord('x_scoped_table');
gr.get("sys_id_of_record_from_scoped_table");

gs.info("Value of field_to_be_changed: ", gr.getValue(field_to_be_changed)) //This returns false (0)
gr.field_to_be_changed = true;
gr.update();

gs.info("Value of field_to_be_changed: ", gr.getValue(field_to_be_changed))//This return true (1)

The application log indicates that the record changes. But, again, the table indicates that no change has been made.  Additionally, the test step does not fail.

The code is also not the issue.  I have tested it in a scheduled job and the record field changed as expected.

I am running everything as admin so I should not have any access issues

1 ACCEPTED SOLUTION

Alok Das
Tera Guru

Hi,

There is a feature of rollback in ATF which reverts all the changes made to a record through ATF.  Please have a look from the below snipped from docs and a link.

find_real_file.png

 

https://docs.servicenow.com/bundle/paris-application-development/page/administer/auto-test-framework...

Also,

Please find the below link for the records which are not rolled back.

https://docs.servicenow.com/bundle/paris-application-development/page/administer/auto-test-framework...

Is the test cases failing? if not so I believe the records are being updated and the tests are being passed successfully and reverted back to keep the test instance clean.

Kindly mark my answer as Correct and Helpful based on the Impact.

Regards,

Alok

View solution in original post

3 REPLIES 3

Alok Das
Tera Guru

Hi,

There is a feature of rollback in ATF which reverts all the changes made to a record through ATF.  Please have a look from the below snipped from docs and a link.

find_real_file.png

 

https://docs.servicenow.com/bundle/paris-application-development/page/administer/auto-test-framework...

Also,

Please find the below link for the records which are not rolled back.

https://docs.servicenow.com/bundle/paris-application-development/page/administer/auto-test-framework...

Is the test cases failing? if not so I believe the records are being updated and the tests are being passed successfully and reverted back to keep the test instance clean.

Kindly mark my answer as Correct and Helpful based on the Impact.

Regards,

Alok

ChrisF2
Tera Contributor

Thank you! This helped me solve my problem.  I will include an additional note here that ATF does not rollback the creation of records.  This is what initially confused me.  I was able to see the creation of my test records but then was not able to see their updates. 

Thank you for the response!  This helped me solve my problem.  I will also note here that ATF does not rollback records that are created.  This is what initially confused me. I could see that my records were being created but I could not see them being updated.