When working with Team System, I was often almost frustrated, because somehow my test or test categories just disappear. To solve the I investigated situation when this happen.
The category file can be "destroyed" when doing following:
1. When migrating the application to Team Foundation Server
2. When creating new solutions and reusing the existing VSMDI file.
3. Sometimes VS creates the new VSMDI file (for some to me my colleagues unknown reason) and categories just disappear.
Problem Description:
First it is important to know that test and related categories are described in XML file with extension VSMDI. This file is usually added to solution in the folder "Solution Items" as show at the next picture.
Usually, the VSMDI file should have the same name as the solution file. In this case file has already been changed from TestApp.Vsmdi to TestApp2.Vsmdi. In some projects I have seen even TestApp47.vsdmi. I do not know what the reason is. If it is a feature, personally, I do not find it neither useful nor funny. If the index of the file is increased sometimes it does not mean that the file is damaged.
For example, the TestApp2.vsmi has an index "2", but all categories are still existing in the test explore as shown at the next picture.
We have in VSMDI file two categories: List 111 and List 2. If the file is damaged it happen what you see at the following picture. As you see all test remains, because they are regenerated but test categories (lists) are no more existing.
The Solution
The damaged test category content is a result of some kind of bug, which is related to updating of the solution file. This sounds strange, but the solution file keeps a reference to the VSMDI file which contains a list of test categories (lists). Following picture shows this in the solution file:
The line TestApp1.vsmd = TestApp1.vsmdi defines the VSMDI file which is used in the solution. However the line CategoryFile = TestApp2.vsmdi defines
the VSMDI file which contains description of test categories (lists). If the file referenced by attribute CotegoryFile does not match the file specified in TestApp1.vsmd = TestApp1.vsmdi the list of categories will not appear in the Test Explorer. Sometimes Visual Studio knows that there is a problem with VSMDI file and tries
to merge information in the file on the disk if found with the newly created VSMDI file. Unfortunately this does not work well
and resulting VSMDI file will be damaged. I would propose, that you add the VSMDI file in the solution, then save solution
and exist Visual Studio. Open the SLN-solution file and change category file as described above. Start Visual Studio and all will work fine :)
Not also, when adding the VSMDI file to the solution add it without of of creating of solution folder. When the file is in the solution Visual Studio will automatically create solution folder with name "Solution Items" and add the VSMDI file there.
Hope this helps.
[Visit www.daenet.eu]
Posted
May 24 2008, 02:11 PM
by
Damir Dobric