Unit Test in Visual Studio
2015-04-27 10:34
597 查看
一直develop code, 突然有人要求写unit test.... 傻眼了。
- Visual Studio 2013 里面已经有现成的unit test流程。
1)新建unit test project (C#-> Unit Test Project)
2)右键项目,add reference, 在这里导入需要被测试的project(可以使用browser定位到相关的project)
3)写unit test的code.
4) On
the Build menu,
choose Build Solution.
5) choose Test on
the menu, then choose Windows,
and then choose Test Explorer.
6) Choose Run
All
===========================================================================================
- unit test is to verify the behavior of the code in response tostandard, boundary, and incorrect cases
of input data, and that verify anyexplicit or implicit assumptions made by the code
The [TestClass] attribute is required in the Microsoft unit testing framework for managed code for any class that contains unit test methods that you want to run in
Test Explorer.
A test method must meet the following requirements:
The method must be decorated with the [TestMethod] attribute.
The method must return void.
The method cannot have parameters.
- Visual Studio 2013 里面已经有现成的unit test流程。
1)新建unit test project (C#-> Unit Test Project)
2)右键项目,add reference, 在这里导入需要被测试的project(可以使用browser定位到相关的project)
3)写unit test的code.
4) On
the Build menu,
choose Build Solution.
5) choose Test on
the menu, then choose Windows,
and then choose Test Explorer.
6) Choose Run
All
===========================================================================================
- unit test is to verify the behavior of the code in response tostandard, boundary, and incorrect cases
of input data, and that verify anyexplicit or implicit assumptions made by the code
The [TestClass] attribute is required in the Microsoft unit testing framework for managed code for any class that contains unit test methods that you want to run in
Test Explorer.
Test method requirements
A test method must meet the following requirements:The method must be decorated with the [TestMethod] attribute.
The method must return void.
The method cannot have parameters.
相关文章推荐
- enable parallel unit test running in visual studio 2010
- Post Build Event for CxxTest in Visual Studio 2005
- Visual Studio Unit Test VS NUnit
- VisualStudio UnitTest FrameWork
- 使用Microsoft.VisualStudio.QualityTools.WebTestFramework.dll中一些函数帮助分析Html(some fuctions in Microsoft.VisualStudio.QualityTools.WebTestFramework.dll help to analyze HTML)
- Unit Test Via Visual Studio
- 简易扩展Visual Studio UnitTesting支持TestMethodCase
- ASP.NET MVC 單元測試系列 (7):Visual Studio Unit Test
- Create a simple unit test project with Visual Studio Unit Testing Framework
- 演练:使用 Visual Studio Team Test 进行单元测...
- Control cannot be created because Visual Studio cannot find the control's type in the control assembly 问题的解决
- ImageMagick (Magick++ for C++) configuration in Visual Studio 2012
- EncodeHD is built in Visual Studio 2010 (VB.NET) so
- The article discusses a couple of new features introduced for assemblies and versioning in Visual Studio 2005.
- Emacs keybinding in Visual Studio 2010
- How do you debug a T4 text template in visual studio 2010 without break point function?
- Qt Visual Studio Add-in: Frequently Asked Questions
- 如何在Visual Studio的工程中共享代码 l How do you share code between projects/solutions in Visual Studio
- What's New in Visual Studio 2008