NUit Test Adapter

安装,两种方式

第一种:从扩展和更新里搜索nunit,进行下载安装

[c#.Net] NUnit Test 体验

第二种:在项目中右键,管理NuGet程序包,搜索nunit

[c#.Net] NUnit Test 体验

打开窗口:

[c#.Net] NUnit Test 体验

编写测试用例:

  • TestFixtureAttribute
    标记类包含测试用例
    • 类必须是public
    • 必须有缺省的构造函数
    • 构造函数没有副作用
  • TestAttribute
    标记测试类中的方法是测试用例
    • 没有参数
    • 不返回参数
    • 必须是public
  • 断言Assert
  • OneTimeSetUpAttribute, OneTimeTearDownAttribute, SetUpAttribute, TearDownAttribute准备及后处理

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2021-06-24
  • 2021-12-26
  • 2021-08-23
  • 2021-10-18
  • 2022-01-11
猜你喜欢
  • 2021-09-20
  • 2022-12-23
  • 2022-01-09
  • 2021-07-28
相关资源
相似解决方案