Managing retention rules

You can create, edit, and delete retention rules to automatically manage and clean up outdated or no longer needed test result data. This ensures that outdated or unnecessary results are managed and storage is optimized.

Before you begin

You must have been assigned the Team Space Owner role in Test Hub.

About this task

Retention rules help teams manage storage effectively, especially in large-scale testing environments with frequent or long-running test runs. The retention rule provides an automated way to identify and reclaim resources associated with test results. You can choose to perform the following tasks:
  • Delete the entire result, removing it from the system completely
  • Delete only the test log and report data, reducing disk usage while keeping result metadata

Procedure

  1. Log in to Test Hub.
    The Projects page of the initial team space is displayed.
  2. Click Manage > Resources.
    The Resources page is displayed.
  3. Click the Rules tab.

    The Rules page displays the following retention rules for the team space:

    • Delete Stale Branches: Deletes test results created on Git branches that no longer exist and are older than 3 days. For example, results from branch edits or Git cleanup.

    • Delete Old Stub Results: Deletes results of type APISTUB that are older than 30 days.

      Note: You can disable these default rules if required.
    In the Rules tab, you can perform the actions that are listed in the following table:
    Task Action
    Enabling or Disabling default retention rule

    Perform the following steps:

    1. Click the Enabled button to enable or disable the rules.

      The Enable Retention Rule dialog is displayed.

    2. Click Ok to confirm your action.
    Adding retention rule

    Perform the following steps:

    1. Click Add Rule.

      The New Retention Rule dialog is displayed.

    2. Enter a name in the Rule Name field.

    3. Select the conditions from the drop-down list. The condition types are:
      • Result age is older than (days)
      • Branch status is
      • Result verdict is one of
      • Result size is greater than (MBs)
      • Result labels contains one of
      • Result labels does NOT contain any of
      • The project is one of
      • The test type is one of
      • Max results per unique test
      • Max results per unique test and verdict
      Note:

      You can add multiple conditions to define a retention rule. For example, you can select the condition The project is one of and choose a project. You can add another condition Result verdict is one of and select the value Pass.

      The Max results per unique test and Max results per unique test and verdict conditions are not displayed if you selected any of the following conditions:
      • Result age is older than (days)
      • Result verdict is one of
      • Result size is greater than (MBs)

      The estimated impact is displayed at the bottom of the window, showing how much data will be freed.

    4. Select one of the following options:
      • Entire Result: Removes all traces of the test result.

      • Just report/testlog: Retains metadata such as verdict and stop reason.

    5. Click Create to add a rule.
    Editing retention rule

    Perform the following steps:

    1. Click the Edit icon Edit Rule next to the rule that you want to modify.

      The Edit Rule dialog is displayed.

    2. Modify the name in the Rule Name field.

    3. Select the conditions from the drop-down list. The conditions types are:
      • Result age is older than (days)
      • Branch status is
      • Result verdict is one of
      • Result size is greater than (MBs)
      • Result labels contains one of
      • Result labels does NOT contain any of
      • The project is one of
      • The test type is one of
      • Max results per unique test
      • Max results per unique test and verdict
      Note:

      You can add multiple conditions to define a retention rule. For example, you can select the condition The project is one of and choose a project. You can add another condition Result verdict is one of and select the value Pass.

      The Max results per unique test and Max results per unique test and verdict conditions are not available if any of the following conditions are selected:
      • Result age is older than (days)
      • Result verdict is one of
      • Result size is greater than (MBs)

      The estimated impact is displayed at the bottom of the window, showing how much data will be freed.

    4. Select Entire Result to remove all the traces of test result or select Just report/testlog to retain the metadata (For example: verdict, stop reason).

    5. Click Update to apply the changes.

    Running retention rule

    Perform the following steps:

    1. Click the Execute retention rule now icon Execute rule to run the rule immediately to identify and delete results matching its conditions.

      The Confirm Recycle dialog is displayed.

    2. Click Yes to confirm the action

    Deleting retention rule

    Perform the following steps:

    1. Click the Delete Rule icon Delete rule to remove the rule from the team space entirely.

      The Delete Rule dialog is displayed.

    2. Click Delete to confirm the action.

Results

You have successfully created, updated, executed, or deleted retention rules.