none
Trying to delete Test Configurations RRS feed

  • Question

  • Hi all

    I'm trying to clean up our Test Configurations in MTM by deleting old Test Configurations that we don't want anymore. All of the Test Configurations that I wanted to remove were referenced in multiple Test Results and Test Points.

    Obviously if I try to delete these Test Configurations before deleting the Test Results and modifying the Test Points I get an error message telling me that the Test Configuration is still in use.

    So what I did was first deleting all Test Results that still referenced the Test Configurations that I want to get rid of. After that I ensured that no Test Cases are combined with these Test Configurations anymore, i.e. there aren't any Test Points referencing the Test Configurations I want to remove.

    This worked fine for all except two of my unwanted Test Configurations. However, no matter what I do, I can't remove these two Test Configurations.

    So I came up with a command line tool to search for all Test Results and Test Points that still reference an unwanted Test Configuration. I search for the Test Results using the following line of code:

    ITestCaseResultCollection testResults = teamProject.TestResults.Query(string.Format("SELECT * FROM TestResult WHERE ConfigurationId = '{0}'", testConfigurationId));

    After that I search all my Test Plans for Test Points that still reference an unwanted Test Configuration:

          foreach(ITestPlan testPlan in teamProject.TestPlans.Query("Select * From TestPlan"))
          {
            foreach (ITestPoint testPoint in testPlan.QueryTestPoints(string.Format("SELECT * From TestPoint WHERE ConfigurationId = '{0}'", testConfigurationId)))
            {
              ...
              code to print out the Test Points referencing the unwanted Test Configurations
              ...
            }
          }

    Now if I execute the code the tool does not list any Test Results or Test Points. Therefore MTM should be able to remove the Test Configurations but if I try to delete them it displays an error message stating that they are still in use.

    Now I simlpy don't know what artifacts could still reference these Test Configurations. What am I missing here?

    Wednesday, January 23, 2013 4:27 PM

Answers

  • There is not supported way to achieve what you are trying to do.
    As Rituparna mentioned  in the forum mentioned above deleting the Test Configurations should never be attempted as that would lead to loss of history.
    Thank you
    Wednesday, February 13, 2013 6:06 AM
    Moderator

All replies

  • Hi ACKH,

    Thank you for your post.

    The TestConfiguration cannot be deleted incase it is being used in any Plan or test result. Incase those plans/results are deleted you can then delete the TestConfiguration. For more information, you can refer to The test configuration cannot be deleted because it is referenced in one or more test results. May be you can set the test configuration inactive.

    Regards,


    Lily Wu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, January 24, 2013 9:17 AM
    Moderator
  • Thank you for your reply.

    In the meantime I figured out that Test Suites, not only Test Plans, can have a list of default Test Configurations. Actually one of the Test Configurations was listed as default Test Configurations of several test suites. So I removed that default from all affected Test Suites. But anyway, this is not enough yet. I'm still unable to delete the Test Configuration.

    Are there any other artifacts anywhere else that can reference Test Configurations?

    Thursday, January 24, 2013 4:47 PM
  • Hi,

    I am trying to involve someone to further look at this issue. There might be some time delay. Appreciate your patience.

    Thank you for your understanding and support.

    Regards,


    Lily Wu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 28, 2013 6:10 AM
    Moderator
  • Maybe you can use the Test Attachment Cleaner Tool to see what is left from your test attachments.
    Please see:

    Test Attachment Cleaner for VS2010 - everything you need to know

    Thank you

    Tuesday, February 5, 2013 2:23 PM
    Moderator
  • I tried to install the Test Attachment Cleaner on my machine but it doesn't allow me to do this. A message pops up that I need either VS 2010 Ultimate Edition, VS Test Professional 2010 or TFS installed.

    Well, I have both VS 2010 Premium and VS 2012 Premium installed. I do not have access to a VS 2010 Ultimate Edition or Test Professional Edition. Besides this, I can't install it on the TFS since I'm at a customer site and I can't just install a tool on a productive server just to play around with it.

    It would be really helpful to replace the generic message that is displayed when I try to delete a test configuration in MTM with a message that actually shows me WHAT is actually referencing the test configuration. The message

    "This inactive test configuration cannot be deleted because it is referenced in one or more test results. Inactive test configurations cannot be added to new test plans."

    just does not help me in any way.

    Are there any other hints to solve this problem? I simply don't find any other entities in the object model of MTM that could be referencing these test configurations.

    I got to say that deleting these test configurations is getting way too expensive now...

    Friday, February 8, 2013 7:24 AM
  • There is not supported way to achieve what you are trying to do.
    As Rituparna mentioned  in the forum mentioned above deleting the Test Configurations should never be attempted as that would lead to loss of history.
    Thank you
    Wednesday, February 13, 2013 6:06 AM
    Moderator
  • I fully understand that point, deleting Test Configurations indeed leads to loss of history. Yet this is completely fine for us in this (exceptionally) case.

    See, these configurations have been created on the productive system although they were merely created for test purposes, i.e. we do not have any use for any Test Results, etc. that are associated with these Test Configurations. I assume this was done because our organization did not have a TFS sandbox environment at that time and people played around on the productive system which is what backfires now.

    I have to admit that our case is a special use case. Nonetheless this can happen from my point of view. I'm sure we are not the only organization with this problem so a option in Test Manager offering the deletion of Test Configurations and all associated objects would be appreciated. Is there any way to officially request this feature for a future version?

    So far I haven't marked any reply as answer yet. I will continue for a solution and post it here if I ever find a way.

    Wednesday, February 13, 2013 9:54 AM
  • From a support perspective this is really beyond what we can do here in the forums. If you cannot determine your answer here or on your own, consider opening a support case with us. Visit this link to see the various support options that are available to better meet your needs:  http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Please use Visual Studio UserVoice site to submit your idea:

    http://visualstudio.uservoice.com/forums/121579-visual-studio

    Thank you

    Wednesday, February 13, 2013 4:03 PM
    Moderator
  • I've end up searching the answer in TFS database directly. And here is what I've found out.

    A new test plan is created together with default test suite which can contain other test suites or test cases. And by default it has assigned test configuration (though the exact logic of this assignment remains unclear for me).

    So this assignment is the root cause.

    Even if you delete all test runs mapped to unnecessary test configuration and make sure none of test cases inside a test plan have it, you still can have default test suite assigned to it. I was unable to reassign it to different test configuration.

    Without digging deeper to resolve the issue I've decided to delete this default test suite, but you cannot do so without deleting the test plan. So the test plan was deleted.

    Once it was done I was able to delete unnecessary test configuration.

    To avoid such issues I've marked only ONE configuration as default (check 'Assign to new test plans' checkbox) which I do not plan to delete anytime soon. I've manually restored deleted test plan. And this time default test suite was assigned to my default test configuration.

    Wednesday, January 30, 2019 9:21 AM