Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

Confused about deleted Test Cases



I’ve written some SQL that returns all Cases where the value of one custom field is “x” and the value of another field is “y” for a given project.

The results contain a number of Case IDs that cannot be found when searching via the TestRail UI. When I enter the C#, it says:

The specified test case was not found.

I’m assuming that these Cases have been deleted, but they still exist in the Cases table. Is there another table or field somewhere that prevents Cases from being searched or shown in the UI?

I just need to understand to a.) make sure nothing has gone wrong and b.) ensure these can be excluded from my results.



Hello Bryan,

Thanks for your posting. You would need to make sure that internal test case copies are not included in the results and this can be done via the is_copy field:

Test case copies are used internally to implement the close feature for test runs.



Thanks Tobias,

I’m afraid I didn’t quite understand that though, sorry. The SQL I have is:

select,, c.milestone_id, c.refs from cases c, suites s, projects p, users u where c.suite_id = and s.project_id = and = 2 and c.refs is not null and c.milestone_id is null and c.user_id =

It returns only a handful of results; with 5 of them I believe to be deleted because I cannot search for them.

I’ve looked at the is_copy field and can’t quite see how that works.

Could you show what other where clause(s) are needed to exclude the deleted ones?



Hello Bryan,

Thanks for the update. You can filter out the internal test case copies as follows:

.. and c.is_copy = 0