nUnit SetupFixture ReferenceNUnit的SetupFixture类进行测试时
我的解决方案是建立这样,使用SpecFlow小黄瓜不会被调用功能
解决方案
- 测试项目
- 特点
- 步骤
- 页面项目
- 页码
我运行nUnit te使用这样的命令ST亚军:
"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框架? – Chris