[英]dotnet test command not finding any test to execute in nUnit
我正在使用 3.12.0 版的nunit和 3.15.1 版的 nunit 測試適配器。 我在 .net 中創建了一個項目,並在類中添加了一個簡單的代碼來運行測試。 從Test->Windows->Test Explorer ,我可以查看和運行測試用例,但是當我嘗試從命令行運行時,它沒有運行任何東西,也沒有給出任何錯誤。
我不確定我錯過了什么。 誰能建議這可能是什么原因?
截屏
我的代碼看起來像這樣
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SpecFlow.API.Test
{
public class Class1
{
[SetUp]
public void setupclass()
{
// Console.ReadLine();
}
[Test]
public void setuptest()
{
Assert.Fail("ERROR");
Console.ReadLine();
}
[TearDown]
public void tearDown()
{
Assert.Fail("ERROR");
}
}
}
```
您似乎缺少TestFixture
屬性
using System;
using NUnit.Framework;
namespace NUnit.Tests
{
// Add TestFixture attribute
[TestFixture]
public class SuccessTests
{
// ...
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.