Freigeben über


OpenWithTest released on Visual Studio Gallery

Download

Either download from the extension manager by searching OpenWithTest or go to the project page here.

Summary

Open with Test is a Visual Studio extension which serves one simple task: To always open your test files and implementation files together.

Details

When writing unit tested applications (especially while practicing TDD) you will often open an implementation file (i.e SomeClass.cs) followed by the test file(i.e. SomeClassTests.cs).  This extension makes this a one step process.

It works by detecting when you open a new file and attempting to find via convention the test file. It assumes that you create one test file per class.  So, if you create a class called Car in the file Car.cs then you will have a test file named CarTests.cs which tests the car class.

Currently, only C# (.cs) files are supported but I plan to expand this to other files types soon.

Configuration

Out of the box, this extension will assume a file is a test file if it ends with the suffix Test,Tests, Fact or Facts.  However, this can be configured.  To change these go to Tools -> Options -> Open With Test and you will see this screen:

image

 

Feedback 

I would love to get feedback about features or suggestion so please feel free to leave a comment on this blog post or start a discussion post on the Visual Studio Gallery page.

Comments

  • Anonymous
    July 01, 2010
    Which direction does this work? If you open the implementation, will it open the tests? If you open the tests, will it open the implementation? And how does it find the corresponding files? I would have guessed it just appends "Tests" to the filename (or class name?), but the example you gave (SomeClass.cs and SomeTestTests.cs) doesn't follow that pattern.

  • Anonymous
    July 03, 2010
    It works in both directions.  When you open either test or implementation it will open the other. The example I gave had a type in it.  I updated the post.  It is supposed to be SomeClass.cs and SomeClassTests. The way the program detects the test file is by looking for the file name with the test suffix added.  If there are multiple files which match this it will compare paths and find the two most similar paths.