Moving, Copying & Deleting Test Cases - TestRail

Moving, Copying & Deleting Test Cases

TestRail makes it easy to streamline your test design and test planning phases with reusable test cases. Test cases are the basic building blocks of the test management workflow in TestRail. You can view your test cases under the Test Cases tab within your TestRail project. This article describes some of the more advanced ways you can organize your Test Cases, such as moving and copying them within your Test Cases repository, as well as deleting/restoring your test cases.

On this page:

    Basics of Moving and Copying Test Cases

    Moving and copying test cases (or entire sections) is often useful to duplicate or rearrange your test suites and test cases. Here, you’ll learn how to copy/move test cases or sections within the same repository or test suite, and how to copy/move test cases between different test suites or projects.

    Copying Test Cases to Rerun Tests or to Test Multiple Configurations / Browsers / OS etc.

    If you want to make a copy of test cases to rerun a test, we strongly recommend using the same test cases in a new Test Run instead. If you want to retest the cases in an existing test run, you can even select “Rerun” from the toolbar of your existing Test Run.

    Alternatively, if you need to test the same test case against multiple system configurations, browsers, operating systems, etc., it is often more efficient to use the Configurations feature of Test Plans. Instead of duplicating test cases for each system you need to test, Test Plans allow you to record test results for the same test across multiple configurations. This can you see all of the test results for all configurations from the same test case history, while giving you the ability record individual test results by configuration / system / browser, etc.

    Test Plan Configurations work best when you need to test the same basic steps against each configuration. However, if different browsers / operating systems require different test steps, then we recommend you to create copies of the test case instead.

    Test Plans can be found under the Test Runs & Results page.

    The most basic way to move or copy test cases within the same test suite is to click and drag the test cases on the Test Cases page.

    Once you drag the test cases to a new area, you will be prompted to choose where you would like to move your existing test cases, or create a new copy of your test cases in that location. Simply select the option from the pop-up menu to finish either moving or copying your test cases.

    If you’d like to skip the pop-up menu, use the following keyboard shortcuts:

    To do this  Press
    Move test case(s) Press and hold the Command / Ctrl key while dragging
    Copy / clone test case(s) Press and hold the Shift key while dragging

     

    These same operations apply to moving or copying whole sections in the main content area as well as the sidebar on the right.

    Moving Test Cases

    Sometimes you will need to move test cases from one section, test suite, or project to another. In this section, you will learn how to move one or more test cases or test sections within the same test repository or test suite, between different test suites, and between different projects.

    Move a single test case within the same project

    To move a single test case, you can drag & drop the case. To do this, simply drag the little grip icon on the left of the checkboxes. 

    If you want to move test cases in the sidebar, simply use drag & drop.

    Move multiple test cases within the same project/test suite

    You can also move multiple test cases by drag & drop case by checking multiple boxes first.

    Move a test case section within the same project

    The easiest way to move sections in the same project is using the section folder icons in the sidebar on the right-hand side of the Test Cases page. If you want to move test sections in the sidebar, simply use drag & drop.

    Move from another test suite (for projects with multiple test suites) and from different projects

    If you want to move test cases or entire sections from another test suite, simply open the Copy or Move dialog from the toolbar of a test suite (it’s the little icon with two sheets of paper in the toolbar).  

    You can select the ‘Source’ from the drop-down menu. The Source is from where you want to copy/move the test cases and the destination is the current folder.

    You can select the section and test cases in the ‘Copy or Move cases’ dialog and also select if you want to copy/move test cases or sections or sections+parents.

    Copying (Cloning) Test Cases

    In some cases, you will want to copy (or clone) test cases from one section, test suite, or project to another. When you make a copy of a test case, TestRail duplicates the test case exactly as-is at the time of copying, including all field values, test results and history, and linked defects. Changes made to the original test case will not persist to copies of the test case made before the changes.

    Copy/clone a single test case within the same project

    To copy or clone a single test case, you can drag & drop the case from the test case repository list, or simply press and hold the Shift key during the operation. To do this, simply drag the little grip icon on the left of the checkboxes.

    You can also copy or clone whole sections or subsections of test cases in the sidebar. If you want to copy/clone test cases in the sidebar, simply press and hold the Shift key while selecting a section or subsection and drag the section to where you would like to copy it or use drag & drop.

    Copy/clone multiple test cases within the same project

    You can also copy/clone multiple test cases by selecting multiple test cases by checking the boxes on the left-hand side of the test case table first. Then drag & drop as you would with a single test case, and select “Copy here.” Alternatively, you can click and hold the Shift key before dragging your selected test cases to automatically make a copy of them.

    Copy/clone a test case section within the same project

    To copy or clone an entire section within a test suite, you can drag & drop a section/s or simply press the Shift key before and during the operation in the sidebar. 

    Copy/clone from another test suite (for projects with multiple test suites) and from different projects

    If you want to copy or clone test cases or entire sections from another test suite, simply open the Copy or Move dialog from the toolbar of a test suite (it’s the little icon with two sheets of paper in the toolbar). You can also use this dialog to duplicate entire test suites. 

    Copy/clone test cases into a baseline

    To copy or clone test cases in a baseline, go to the baseline where you want to copy the test cases and then click on ‘Add Baseline’. Now select a project or the test suite from the ‘Copy From’ dropdown in the ‘Add Baseline’ dialog and click on Add Baseline.

    Deleting and Restoring Test Cases

    Deleting test cases will delete any associated tests from open test runs and plans. Users can delete test cases by marking them as deleted, or permanently and immediately deleting them. Test cases marked as deleted will be hidden from TestRail, but will be restorable for 7, 14, or 30 days. This can be configured by a TestRail administrator inside Administration > Site Settings > User Interface. Test cases permanently deleted will be immediately removed from the TestRail database and cannot be recovered without a full database restore.

    Please Note: To avoid losing test data, we recommend closing test runs and plans as outlined here and restricting the permission to permanently delete test cases.

    When marking test cases as deleted, the test cases are placed in a deleted state, removing them from test runs and plans, but keeping them in the TestRail database. You can show or hide these deleted test cases in the UI by toggling the button shown here:

    From the time test cases are marked as deleted and until the configured retention period passes, Test cases in this deleted state can be restored in a few ways:

    • By opening the bulk edit screen for deleted test cases.
    • By viewing a deleted test case and clicking on the restore or edit button.
    • Using the TestRail API and updating the is_deleted field.

    How to Bulk Restore Cases Marked as Deleted

    If you have marked test cases as deleted and they have not been deleted permanently yet, you can restore them in bulk through the following process.

    1. In your test case repository, toggle on “Display Deleted Test Cases”
    2. Select the test cases in your repository that have been marked as deleted by click the checkboxes on the left
    3. With the test cases you want to restore selected, click the Edit button in the toolbar at the top of your test case respository, then select Edit Selected
    4. A pop-up will appear prompting you to confirm that you would like to restore the cases marked as deleted. Click OK.
    5. Your cases have now been restored! 🎉
    6. After your cases are restored, you will automatically be redirected to the bulk edit cases page for the cases you had selected. If you want to make any bulk changes to those cases, you can do so now. Otherwise, simply click Cancel to navigate back to your test case repository.