Unit Test in Visual Studio

一直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.

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.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值