It is common, when cloning over a sub-production development instance, that an administrator may want to retain objects associated with the Automated Test Framework (ATF). The usual method to accomplish this is through the use of Data Preservers, configured on the clone source instance.
A brief description of the most common tables associated with the ATF will be helpful in determining which tables should be preserved.
Primary ATF Related Tables
The following are the major tables associated with the ATF module and a brief description of the purpose of said table:
- sys_atf_step --> Test Step - This table contains the definition of one specific test step which is part of a test.
- sys_atf_step_env --> Test Step Environment - This table contains information regarding the configuration of the actual enivonments that run the test steps on the instance. This table should never need to be preserved during a clone operation.
- sys_atf_schedule_run --> Scheduled Suite Run - This table contain the specific information associated with an individual scheduled run of a test suite.
- sys_atf_test_result_step --> Step Result - This record contains the result information associated with the specific run of an individual test.
- sys_atf_test_template --> Table which contain base templates which can be used as the starting point for making certain types of tests.
- sys_atf_test --> This is the table that contains the actual test records on the instance, out-of-box sample tests as well as custom user created tests.
- sys_atf_step_config_category --> Test Step Config Category - This table contains the various Step Type categories such as Server, Form, Rest, and Service Catalog. These should generally not need to be retained during a clone unless, in the rare event, custom step configuration categories have been created.
- sys_atf_variable --> This is the base class containing common fields used by the atf_input_variable and the atf_output variable extended classes.
- sys_atf_test_result_item --> Test Result Item - This table contains the individual list lines that detail the specific results from one run of an ATF test.
- sys_atf_test_suite_result --> This table contains the result sets for one specific run of one test Suite.
- sys_atf_test_suite_test --> Test Suite Test - This table contains the associations of an ATF Test Suite to the individual tests which form that suite.
- sys_atf_test_suite --> Test Suite - This table contains the details for a specific test suite as stored on the instance.
- atf_output_variable --> Output Variables - This table contains the specific output variables as associated to a specific test case.
- sys_atf_step_config --> Test Step Config - This table stores the specific, configurable test types which an ATF user can add to a new test case. These are generally uneditable records and so generally should to need to be added to a Clone Data Preserver list.
- sys_atf_transaction_mtom --> Step Result Transaction - This table contains the direct relationship amongst a specific test run (sys_atf_test_result_step) and a transaction (syslog_transaction) that had occurred during that run. If this table is retained the syslog_transaction should also be retained.
- sys_atf_agent --> Test Runner - This record type contains a current list of Test Runners that are on this instance. These test runners are temporary and should generally not be retained on an instance during a clone.
- sys_atf_schedule --> Suite Schedule - This table containing all the configured schedules for running test suites on the instance.
- atf_input_variable --> Input Variables - This table contains records corresponding to specific Input variables as associated to a specific ATF test.
- sys_atf_remembered_values --> Remembered Value - This table contains the values passed from one test step to another as assigned to a variable. The records in this table are temporary and will normally only remain in the table as long as the test the variable is associated to is running. This table should never need to be retained during a clone operation.
- sys_atf_test_result --> Test Results - This table contains the specific individual test result as associated to one run of a specific test.
- sys_atf_whitelist --> WhiteListed Client Error - This table contains a list of specific client side errors that the system should bypass and ignore if encountered when running a test.
By default, the tables usually associated with the Test Results of previously run tests are included in the list of Data Preservers, however in many cases it is also necessary to include tables associated with the actual tests and test suites.
The specific set of tables which should be preserved during a clone are directly dependent on what customized aspects of the ATF the admin prefers to have retained on the target instance after completion of the clone. The following provides the major scenarios that an Admin might encounter in deciding what tables to preserve during a clone with regards to the ATF.
Retain Previous Test Results
In a new, out-of-box instance, the following tables are already preserved with regards to previously run ATF tests:
These Clone Data Preserver records correspond to the main tables as used by the ATF to store the results and related records from an ATF Test or Test Suite run. Note that, by default the individual transaction results from a test run are not preserved. This is because these are generally not as important in analyzing the results of an individual test run. However, if for any reason, these are required, the following two additional tables should be added to the tables preserved for retaining test results:
The syslog_transaction table is actually not specific to the ATF and thus, preserving this table will also contain data that may not necessarily be needed.
If, on the other hand, the user does not want to retain the ATF test results after a clone, all these tables should be removed from the Data Preservers list (clone_data_preserver table).
Retain ATF Tests and Test Suites
By default none of the tables associated to the actual tests themselves are preserved. Thus, if the admin needs to retain the actual tests on the target instance, appropriate Data Preservers will need to be created for each of the tables that is associated with these tests. The following shows the most probable tables that an admin may want to preserve:
The following are the tables that should always be retained if intending to retain the tests on a target instance of a clone:
The aft_input_variable, atf_output_variable, and sys_atf_variable records are commonly overlooked and thus, after the clone users may find that test steps are missing specific configurations that were previously there before the clone operation.
Many customers are using the individual ATF test functionality but are not using the grouping of these tests into Test Suites. If the test suite functionality is not being used, the tables as described in this section need not be included in a data preserver. However, if test suites are used on the instance, it is probable that, if retaining the tests themselves, the suites will also need to be retained. In those cases, the following tables will probably need to be added to the Clone Data Preserver list:
ATF Test Schedules
If ATF schedules are also being used on the instance, the following additional tables should also be added to the Clone Data Preserver list to retain the schedules as well:
Note that ATF Schedules are designed to be used with Test Suites. Thus, if schedules are in use, this also indicates that Test Suites are also in use on the instance. Thus, you will also want to ensure to preserve the tables associated to the Suites as well.
Other Table Types
In addition to test results and the test configurations, there are a few other tables that a user may optionally want to include in a Data Preserver list for use during a clone.
The sys_atf_test_template table should be included as a Clone Data Preserver if test templates are in use on the instance. A test template is basically an outline which can be used as a starting point for creating new ATF tests of a specific type. If these templates are not used, there is no need to include a Data Preserver as the template table will otherwise be empty.
Similarly, if the ATF test users or administrators have created any custom records indicating specific Client Errors that should ignored during a test, the sys_atf_whitelist table should also be included as a Clone Data Preserver.
A number of tables are used by the system for temporary or short-term storage of data during test runs and should never be included in the Data Preserver list, These include the following:
In addition, there are a number of tables which are generally included as a core part of the platform and cannot or should not be modified new records of that type created. These include the following:
The following ServciceNow Docs site article describes Data Preservers and includes the steps to create a new Data Preserver record: