我的解决方案是这样设置的,使用 SpecFlow Gherkin Features
Solution
- Tests Project
-- Features
-- Steps
- Pages Project
-- Pages
我使用如下命令运行 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()
{
}
}
}
我究竟做错了什么?为什么[SetupFixture]
在 nUnit 开始所有测试之前不调用?