



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




This article will show how the Unit Testing in VS2008 works and what features are available to everyone.
There are other Unit Testing tools that perform similar functions. One that I have used in the past
as many of you have used as well is NUnit. There are other ones that do deviations of Unit Testing as well, such as MBUnit.
Once you have a project that works and has class files, you can create a Unit Test. To start, we
need to create the basic tests. A Unit Test can be created from the Test menu.
Once you select the menu item, this dialog will be displayed
The options are:
If you select the Unit test wizard, this dialog will appear so you can select what classes will be tested:
Once you select the methods, the wizard will create the source file(s). There will be a source file
for each class that you have selected to be tested. An example of the source code the wizard generates is shown below:
///
As you can see, the arguments are set with default values; for the test to be completely effective, you must fill in the values that fit your requirement. After you set the correct values, you can run
your project as a normal project. The final testing results will appear in the window as shown below.
The Unit Test option will create a source file that will contain the following code snippet: [TestMethod] public void TestMethod1() { // // TODO: Add test logic here // } You must fill TestMethod1 to do the tests you need to perform. You can add more tests to test
the methods you want tested. This is very similar to NUnit where you write what tests you want to have done.
When this option is selected, this dialog will appear so you can select what test(s) you want to run and in what sequence: