我在VS代码中运行一个带有XUnit核心测试资源管理器扩展的.NET测试-ptoject。我试图在测试过程中编写输出,但是没有什么效果。我尝试过用不同的方式编写输出,但是在任何地方都看不到输出。有没有人在运行测试时以某种方式看到vs代码中的输出?
下面是一个小示例类:
using Xunit;
using Xunit.Abstractions;
using System.Diagnostics;
public class TestClass
{
private ITestOutputHelper _output;
public TestClass(ITestOutput
使用xUnit 2.4.1,当涉及到动态跳过集成测试时,我正在寻找一种方法让它执行我扭曲的命令。
我知道xUnit不是为集成测试而设计的,但我不打算在某些测试中使用xUnit,而在其他测试中不使用-xUnit。我认为单元测试和集成测试之间的区别对于测试运行者来说是非常无用的。
这样一来,我就有了一些依赖于数据库的测试。我在测试中添加了如下特征。
public class Some_database_interaction
{
[Fact]
[Trait("Demand", "SqlServer")]
public async Task O
我使用Net Core3.1创建了一个与XUnit的解决方案。我刚刚创建了一个使用Selenium的测试。当仅运行此测试时,它将连续运行两次。我不明白这种行为是从哪里来的。 using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;
using Xunit;
namespace LabXUnitTest
{
public class UnitTest1 : IDisposable
{
private readonly IWebDriver _driver;
public
在Visual Studio 2015 RTM中,我们遇到了一个错误,即VS测试资源管理器窗口中没有显示任何测试。仅在重建时出现以下错误:
------ Discover test started ------
Unable to find the runtime installation directory for the source: 'C:\repo\src\Solution\src\Project1.Testing\project.json'
Unable to find the runtime installation directory for the sourc
我有一个Visual 2012项目,并安装了以下NuGet包:
使用Moq进行自动模拟的AutoFixture
基于xUnit.net数据理论的自动夹具
AutoFixture
莫克
xUnit.net:扩展
xUnit.net:跑步者
xUnit.net
给定以下人为的Logger类(Logger.fs):
namespace FUnit
type public ILoggerContext =
abstract member LogPath :string
type public LoggerContext (logPath :string)
我正在Visual中创建一个测试项目。它构建,但未能发现项目中的测试,出现以下错误:
Unable to start C:\Program Files\dotnet\dotnet.exe
dotnet-test Error: 0 : [ReportingChannel]: Waiting for message failed System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your
在我的一生中,我无法从新的基于msbuild的netcoreapp1.0 xunit项目模板中获得在Visual 2017中工作的单元测试。
对于自动化的构建过程,单元测试需要在Visual内部(对于devs)和从CLI上的dotnet test中工作,但是,我不能使两者一致工作。
以下是我尝试过的:
在现有解决方案中,创建一个新项目并选择.NET Core > xUnit Test 。
从Visual生成项目,出现默认测试并成功运行,现在从powershell提示符运行dotnet test,获取:
> dotnet test
Test run for D:\...\bin\
我的Visual Studio确实发现了我的Xunit测试,但是"run all“(ctrl+R,A)不会运行它们。但是,我可以手动选择这些测试来运行它们。
控制台输出:
========== Discover test finished: 2 found (0:00:01,6982309) ========== ------ Run test started ------ ========== Run test finished: 0 run (0:00:01,8070484) ==========
除了XUnit,我还安装了xunit.runner.console和xunit.ru
当尝试通过Visual Studio运行使用xunit框架的测试用例时,我当前得到以下错误。
System.InvalidCastException
HResult=0x80004002
Message=Specified cast is not valid.
Source=xunit.execution.desktop
StackTrace:
at Xunit.Serialization.XunitSerializationInfo.GetValue[T](String key) in C:\Dev\xunit\xunit\src\common\XunitSerializa
我正在使用.NET并得到这个错误,这是我第一次这样做,所以我真的不知道如何解决这个问题。我有两个我正在处理的文件,一个叫做"UnitTest1.cs“,它是错误发生的地方,它说它发生在关于'ValuesController‘的第12行,代码就在这里
using System;
using Xunit;
using SimpleAPI.Controllers;
namespace SimpleAPI.Test
{
public class UnitTest1
{
ValuesController controller = new Va
因此,在vscode的1.59中,“本机支持在内置的中运行VS代码中的测试。”添加()。
我的问题是,我到底该如何使用它?我可以找到大量关于如何使用第三方扩展来实现它的资源,实际上,在上面链接的发布说明中,它的名称是"Test“()。然而,这就是说,由于上述本机实现,它现在被折旧了。即使这样,如果我安装了它,我也会得到一个图标,但下面没有测试。如果我遵循那些发行说明中的小文档“通过将testExplorer.useNativeTesting设置为true来获得本地体验”,图标就消失了,我回到了原点。
也许这是对现实的期望,我使用的是..net core,如果我像这样设置了一个项目:
d
xUnit为[Fact]属性提供了DisplayName属性,以指定如何在Visual中的测试资源管理器中显示测试。例如:
public class BooksIntegrationTests
{
[Fact(DisplayName = "GET /api/books returns http status code 200")]
public Task Get_Books_ReturnsCollectionOfBooks()
{
// ... test code
}
}
因此,Get_Books_ReturnsCollectio
我尝试使用TestDriven.NET运行xUnit测试(从F#模块,如果有任何不同的话),但是无论我做什么,我都会得到这个错误:
It looks like you're trying to execute an xUnit.net unit test.
For xUnit 1.5 or above (recommended):
Please ensure that the directory containing your 'xunit.dll' reference also contains xUnit's
test runner files ('
我在我的项目的竹计划下配置了xunit解析器任务,我运行了我的计划:启动任务'com.wwwlicious.xunit.xunit:xunitParser‘类型的失败任务,因为需要测试用例,但没有找到。
它会影响我的xunit 解析器,它只解析由prev步骤产生的测试结果?
我尝试添加一个脚本任务来手动运行xunit测试:
C:\SomeApplication>dotnet test -l:trx;LogFileName=SomeApplTests.xml
Build completed.
Test run for C:\SomeApplication\bin\Debug\net
我试着用FsCheck和xUnit做我的第一次测试。我有以下设置:
具有单个文件的F#类库
名称空间Lib类型ABC =A\B=C
一个名为Test的项目,它引用了带有单个文件的FsCheck.xUnit NuGet包:
模块LibTests打开FsCheck.Xunit打开Lib让ABC is always A v=v=A
当我运行项目(使用VS或控制台运行程序)时,我会得到以下错误:
System.Exception : The type Lib.ABC is not handled automatically by FsCheck.
Consider using ano
在使用xunit的dotnet test 5.0项目中运行命令行测试( .net )时,所有测试似乎都已通过,但进程崩溃时,dotnet test的详细内容如下所示
Catastrophic failure: System.ArgumentException : There is at least one object in this array that cannot be serialized (Parameter 'array')
[xUnit.net 00:00:03.74] [FATAL ERROR] System.ArgumentException
[xUn