【发布时间】:2017-06-16 13:22:56
【问题描述】:
我的解决方案是这样设置的,使用 SpecFlow Gherkin 功能
解决方案
- 测试项目
-- 特点
-- 步骤
- 页面项目
-- 页面
我使用如下命令运行 nUnit 测试运行器:
"C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" ".\bin\Dev\Solution.dll"
我已经将此代码添加到上面项目结构的步骤文件夹中。
using System;
using NUnit.Framework;
namespace TestsProject.StepDefinitions
{
/// <summary>
/// This class needs to be in the same namespace as the StepDefinitions
/// see: https://www.nunit.org/index.php?p=setupFixture&r=2.4.8
/// </summary>
[SetUpFixture]
public class NUnitSetupFixture
{
[SetUp]
public void RunBeforeAnyTests()
{
// this is not working
throw new Exception("This is never-ever being called.");
}
[TearDown]
public void RunAfterAnyTests()
{
}
}
}
我做错了什么?为什么在 nUnit 开始所有测试之前不调用 [SetupFixture]?
【问题讨论】:
-
您使用的是哪个版本的 NUnit 框架?
标签: c# nunit test-runner