Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Beginners introduction to unit testing in Visual Studio 2008

Tags:

People also ask

How do I run a unit test in Visual Studio?

Run tests in Test Explorer If Test Explorer is not visible, choose Test on the Visual Studio menu, choose Windows, and then choose Test Explorer (or press Ctrl + E, T). As you run, write, and rerun your tests, the Test Explorer displays the results in a default grouping of Project, Namespace, and Class.

How do you introduce unit testing?

To perform unit testing, you have to test every output of your code unit with their expected return value to confirm if they adhere to their contract. Run your tests to confirm if your code unit is working as expected. Now, say you were to change the expected output of your test to a wrong value.

How do you do simple unit testing?

A typical unit test contains 3 phases: First, it initializes a small piece of an application it wants to test (also known as the system under test, or SUT), then it applies some stimulus to the system under test (usually by calling a method on it), and finally, it observes the resulting behavior.

What is unit test project in Visual Studio?

Unit tests often mirror the structure of the code under test. For example, a unit test project would be created for each code project in the product. The test project can be in the same solution as the production code, or it can be in a separate solution. You can have multiple unit test projects in a solution.


I'm a self-taught developer and my experience is all in small applications that I've developed.

I'm currently working on an application that I've made public, and I've realized that I need to start doing good unit testing to catch regressions and generally make sure everything works.

I've read up on a previous question. I would like to know if there are any resources online specifically dealing with C# unit testing in Visual Studio 2008, preferably with examples.

EDIT: I'm using Visual Studio 2008 Professional for Windows applications, no web development.