How to delete a Test Case / any other Work Item?

Note: Cross posted from Rubel's Blog.

I saw some Qs on forums asking about how to delete a test case from MTM (Microsoft Test Lab Manager). Please note that you can’t delete a test case from MTM. But as test case is eventually a work item so you can achieve the same using witadmin provided you’ve admin permissions. witadmin is a command-line utility and is located in %Program Files%\Microsoft Visual Studio 10.0\Common7\IDE. Please note that this is an admin operation and we don’t encourage using it a lot in general. The usual guideline is to close the obsolete / not required test cases and move it out of your test suite.

Anyhow, here is the way to delete the test case or any other work item using witadmin:

witadmin destroywi /collection:CollectionURL /id:id [/noprompt]

The following example deletes the work items with IDs, 12, 15, and 23 from the database for Collection1 on the AdventureWorksServer server:

witadmin destroywi /collection:http://AdventureWorksServer:8080/AWTeam/Collection1 /id:12,15,23

You can read in detail about permanently removing work items using witadmin here.

Note: Cross posted from Rubel's Blog.

Comments (2)

  1. Bharatqa says:

    Hi Ribel,

    I am not able to deletye test case from my TFS server

    Server Name = pune-tfs

    Port 8080

    Project name : SagitecStudio

    please help me to execute this command

    How to get collection ???



    Pune – INDIA

  2. Rajneesh Prakash says:

    Hi Ribel,

    How to get collection ???

    The answer is you will get the collection name under

    Team foundation server administration console window->Application Tiet -> Team Project collection->Collection URL.

    Rajneesh Prakash

Skip to main content