Configuring Cleanup of Old Test Runs

There is a job that deletes old Test Runs to free up system resources and speed up system re-indexing. By default, this job will not run. An administrator can enable it, and configure how the job selects Test Runs for deletion, in the global configuration and/or any project configuration. In Administration: Testing > Configuration: Automated Cleanup of Test Runs.

When enabling the job, the administrator may specify a query that returns the Test Runs to be deleted by the job. (See the embedded Help in the Administration topic for more information and an example of such a query.) When the job is enabled in the global scope, and no query is specified, the system will run a default query that selects for deletion all Test Runs in all projects without a project-scope configuration. Test Runs that are Test Run templates, and Test Runs having the Keep in History option set on them will always be ignored by the job and will never be deleted. When Test Runs are deleted by the job, no email notifications are generated, and nothing is shown in the Activity stream.

Automated Cleanup of Test Runs can be enabled and configured in projects to gain more precise control of how the job deletes old Test Runs. Again, the administrator can specify a query, and it will apply only to the current project. As in the global scope, the job will never delete any Test Runs that have the Keep in History or the Is Template option set, even if the Test Run meets the search criteria in other respects. (Note the Keep In History can be set in Test Run templates.) It is therefore not necessary to include these as elements of the selection query. Be sure that users know to set Keep in History for Test Runs that should have results preserved for traceability and proof of compliance, and check for existing Test Runs that may need to have this option set before enabling the job and deleting old Test Runs.

Remember that all projects that do not have a project configuration for clean-up of old Test Runs will have Test Runs deleted according to the global configuration settings in the Automated Cleanup of Test Runs topic of Administration. This could be a problem if such projects contain Test Runs that need to be preserved for proof of regulatory compliance, but to not have the Keep in History option set. Be sure to do some checking before enabling the cleanup job in the global configuration.

If you want to schedule the cleanup job to start automatically, note that it cannot run on behalf of system user because that user does not have write access to the Subversion repository. There is a parameter for the job, userAccountValultKey that can point to a key in the User Account Vault so that the job will run on behalf of this configured user, which should have the required SVN access. Generally, the same configured user should also be used for xUnit import and automatic creation of Test Runs. If you have this configured, just use the same user for the Test Run cleanup job.

<job cronExpression="0 0 6 ? * SUN" disabled="false" id="" name="Cleanup of Old Test Runs"  scope="system">


Before running the job for the first time, be sure to check with project leaders to make sure that they have set the Keep in History flag on all Test Runs that should be preserved in Baselines for compliance reporting and other purposes. For more information, see the User Guide topic: Preserving Test Runs in History.