I'm trying to get some BDD testing working using dotnet core and xunit.gherkin.quick. ( https://github.com/ttutisani/Xunit.Gherkin.Quick )
I've created a project that works fully on Windows https://github.com/Richie5555/QuickTest
By fully work, I can issue the command 'dotnet test' and I get a passing test and I can issue the command 'dotnet xunit' and I get a passing test. (I need to run 'dotnet xunit -xml results.xml' in the end to get an xunit test report.
However, when I try to run this on Linux (centOS) 'dotnet test' workd as expected, however 'dotnet xunit' does not finds any tests.
Having googled for a couple of days (and trying many things) I'm stumped!
Please can anyone help solve this?
my .csproj file is:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RuntimeFrameworkVersion>2.1.5</RuntimeFrameworkVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.gherkin.quick" Version="3.3.0" />
<PackageReference Include="xunit.runner.console" Version="2.4.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<None Update="./FeatureFiles/*.feature">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
My Feature File is:
Feature: FeatureOne
Scenario: ScenarioOne
When I add 1 plus 1
Then the answer should be 2
My StepDefinition Files is:
using Xunit;
using Xunit.Gherkin.Quick;
namespace QuickTest.StepDefinitions
{
[FeatureFile("./FeatureFiles/FeatureOne.feature")]
public sealed class FeatureOneSteps : Feature
{
private int _Answer = 0;
[When(@"I add 1 plus 1")]
public void IAdd1Plus1()
{
_Answer = 1 + 1;
}
[Then(@"the answer should be 2")]
public void TheAnswerShouldBe2()
{
Assert.Equal(2, _Answer);
}
}
}
Running 'dotnet --info' on Windows (Works fine):
.NET Core SDK (reflecting any global.json):
Version: 2.1.403
Commit: 04e15494b6
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.403\
Host (useful for support):
Version: 2.1.5
Commit: 290303f510
.NET Core SDKs installed:
2.1.403 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Doing the same on Linux:
.NET Core SDK (reflecting any global.json):
Version: 2.1.403
Commit: 04e15494b6
Runtime Environment:
OS Name: amzn
OS Version: 2
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/2.1.403/
Host (useful for support):
Version: 2.1.5
Commit: 290303f510
.NET Core SDKs installed:
2.1.403 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Please let me know if there is more info that is needed to allow you to help me! :)
Aucun commentaire:
Enregistrer un commentaire