Sdílet prostřednictvím


Implementing a Custom Test Type - Part 3 (Dissecting the MyTest Sample - 1)

This post deals with the MyTest sample. I will start at the beginning of time.

Pre Requisites

I copied over the MyTest folder in the Visual Studio SDK to a separate directory. In doing so, I discovered some issues with the MyTestUI project. You will have to open up the MyTestUI.vcproj file in NotePad and replace the "..\..\..\..\VisualStudioIntegration\" parts with PATHTOVSSDK\VisualStudioIntegration. This ensures that the copied over solution builds correctly.

Another point to note is that I moved the entire solution to a location with no spaces in the path. That way I don't have deal with all the long name related issues. (As a matter of principle, I usually never put anything except the default stuff in locations with spaces in the name.)

A third action is to go through the registry searching for anything with a "MyTest*" entry and deleting them. This ensures that we are starting with a clean slate.

Finally, open up MyTest.sln. Fix your solution configuration. MyTestUI.vcproj is a VC project targeting Win32 and MyTest.csproj is a C# project targeting AnyCPU. Make sure your solution has only one configuration that builds the (Debug, Release) configurations with the Win32 and AnyCPU platforms for these projects respectively.

OK. Now open up MyTest.sln and rebuild everything. Open a VS command shell (in your Start menu folder for Visual Studio 2008, there is a Visual Studio Tools folder). Navigate to the location you copied the MyTest sample to and execute deploy.bat Debug. That should succeed.

Then execute devenv /setup. This ensures that your project and item templates are rebuilt. Start up Visual Studio, create a test project. Then add a new test item and voila! you should see MyTest and a MyTest Wizard entry in the test types dialog.

More on what happens after you select the MyTest test in the next post.