Is there a detailed β€œhow” on unit testing for Visual Studio 2005

I never wrote / ran unit test. I am a relatively young programmer, but I read a lot. I was looking for information on unit testing because I see a lot of things, but I did not come across what really explained this to me from step 1.

I have Visual Studio 2005 Professional. In the next couple of days I will start the project with new windows, and I would like this project to be cut off from my module, but I don’t even know where to start. I have seen sites that say that VS2005 has built-in testing, but in the following examples I see that I do not have the same context menu content. Should I create a separate project or class? And what is this regression? Will the tests be executed every time they are created?

SO has a lot of great content on why using unit testing, so I hope some participants can provide or point me to very thorough unit test results of the install-run execution.

+6
unit-testing visual-studio testing visual-studio-2005
source share
6 answers

In unit test in Visual Studio 2005, you will need Team Team or a third-party unit test framework such as nUnit.

There's a quick launch page for nUnit that helps you decide if nUnit is right for you. nUnit is similar to the built-in testing of Visual Studio 2008.

http://www.nunit.org/index.php?p=quickStart&r=2.5

You should also get TestDriven.net . TestDriven.net is a Visual Studio add-in that will integrate nUnit with Visual Studio.

The Art of Unit Testing Roy Osherov is a good book about unit testing. Roy Osherove talk in Scott Hanselman's podcast here . A podcast is an excellent introduction to some of the principles and practices of unit testing:

http://www.hanselminutes.com/default.aspx?showID=187

+6
source share

As much as I admire you, wanting to learn, can I respectfully urge you to stay away from mstest. As far as it seems easy in the beginning, mstest is not a good test environment. It does simple things easily, and perhaps it will cover the learning process, but more complex scenarios do not always work well with the MS testing philosophy. I would suggest you start with a simpler structure like xunit, nunit, along with ridicule from nmock and moq.

This framework is not only clear - they have huge communities behind them, and getting help will be easier as a beginner.

I agree with Robert Harvey in the answer β€œThe art of unit testing” by Roy Osherov.

+3
source share

Visual Studio 2005 Professional does not have built-in unit testing. I suggest you download the latest version of NUnit. You must create your tests in a separate project for your code. Tests will not run as part of your assembly, but you can create a script assembly that compiles your code and runs the tests using MSBuild or NAnt.

As for getting started, look for articles on unit testing with NUnit. They are easier to find than with unit testing with Visual Studio.

0
source share

Work with unit tests .

Also try http://social.msdn.microsoft.com/Search/en-US/?Refinement=26&Query=unit+test .


In 2005, this is not enough.

Read the Test-Driven Development at Microsoft.NET (Microsoft Professional) , which James W. Newkirk and Alexei A. Vorontsov, two of NUnit's former developers.

0
source share

Another alternative to learning MSTest is to grab one of the trial versions of VS 2008 from here . I think the trial period is 90 days to play with it. After you installed it, we found the following blog post and document , it is very useful for getting started with TDD based on VS 2008 \ MSTest.

0
source share

If you need some visual aids and explanations, dimecasts.net . They have a good selection of videos and are pretty short.

I use the following tools for unit test (just in case you do not have access to the command system):

Nunit
Rhinomocks
NCoverage
R # is not free, but a great tool around

0
source share

All Articles