- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我经常想执行快速测试,并在 LINQPad 中对其进行编码。
所以我有一个 Main()
入口点。我可以让 NUnit 从那里以编程方式“运行”夹具吗?
using NUnit.Framework;
public class Runner
{
public static void Main()
{
//what do I do here?
}
[TestFixture]
public class Foo
{
[Test]
public void TestSomething()
{
// test something
}
}
}
最佳答案
您可以使用 NUnitLite Runner :
using NUnit.Framework;
using NUnitLite;
public class Runner {
public static int Main(string[] args) {
<b>return new AutoRun(Assembly.GetExecutingAssembly())
.Execute(new String[] {"/test:Runner.Foo.TestSomething"});</b>
}
[TestFixture]
public class Foo {
[Test]
public void TestSomething() {
// test something
}
}
}
这里 "/run:Runner.Foo"
指定了文本夹具。
请注意,您还必须引用 nunilitlite.dll
包。
关于c# - 以编程方式运行 NUnit 测试夹具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45310571/
是否可以设置一个夹具来创建数据库 View 而不是 CakePHP 中的数据库表?在创建表的夹具和另一个应该是数据库 View 的夹具中使用相同的数据似乎效率低下。 最佳答案 我设法这样做,其中 vi
与这个锦标赛赛程算法作斗争。 代码运行良好,但我需要帮助将数据插入 mysql我似乎无法访问 $varables.. 非常感谢 php 专家的任何调整 ... $teamnames = "Arsena
我正在尝试开始使用 Symfony2,并一直在尝试为我的应用程序的模型层设置自动化测试。 Symfony2 书讨论了 Controller 的单元测试,但我找不到很多模型测试的示例。 我希望在每次测试
我想为我的测试使用一个通用的夹具: @RunWith(JUnitPlatform::class) abstract class BaseSpek: Spek({ beforeGroup {pr
使用这个固定装置,我想根据 before 固定装置 Hook 中 API 调用的结果设置 checkoutId,这样我就可以用它来设置页面我的测试 let checkoutId; fixture`Ch
我尝试过各种尝试。这是我最新的。我只是想 stub Axios 请求并返回固定装置。 const { expect } = require('chai'); const sinon = require
我是一名优秀的程序员,十分优秀!