Visual Studio 2010 comes with unit tests

Source: Internet
Author: User
Tags visual studio 2010

Usually more accustomed to do unit testing with NUnit, today found that vs comes with the actually very good, the following directly began to try hackers

1. Create Unit Test Project

Select the class, function, or classes you want to test as needed ...

As long as you click OK, vs will automatically generate a test class for you without having to hit the code yourself.

Here's what you need to test, modify the test function, the usual validation functions can refer to MSDN,

Http://msdn.microsoft.com/zh-cn/library/microsoft.visualstudio.testtools.unittesting.assert.aspx

2. Testing

Menus commonly used in: New, run Test, debug, editor, etc...

After the test function has been modified, you can execute the test, you can click "Test All" directly, or you can choose the function you want to test as well.

3. Test results

If the function does not pass the test, you can modify the function according to the error message

4, additional words

If you want to monitor the values of variables in the process like a debugger, you can also add a breakpoint to the test function and click Debug .... Test ";

If you have access to a configuration file or resource file in a function you are testing, you need to manually copy the configuration file to the test project.

Of course, there are many simple ways to implement the Internet, we can refer to the following

Http://www.cnblogs.com/kissazi2/archive/2013/03/15/2960661.html

Visual Studio 2010 comes with unit tests

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.