-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xunit test framework fails to find tests #20
Comments
This ticket is a bit stale (all my fault), did you get this working? Otherwise seeing your project file would help to further diagnose. |
I've also been able to reproduce this issue using the example in the readme. My test cluster is created like so: using Elastic.Elasticsearch.Xunit;
[assembly: Xunit.TestFrameworkAttribute("Elastic.Elasticsearch.Xunit.Sdk.ElasticTestFramework", "Elastic.Elasticsearch.Xunit")]
namespace Elastic.Test {
public class TestCluster : XunitClusterBase {
public TestCluster() : base(new XunitClusterConfiguration("7.8.0")) { }
}
} And used in the test: using Elastic.Elasticsearch.Xunit;
using Elastic.Elasticsearch.Xunit.XunitPlumbing;
using Elasticsearch.Net;
using FluentAssertions;
using Nest;
namespace Elastic.Test {
public class ExampleTest {
public ExampleTest(TestCluster cluster) {
this.Client = cluster.GetOrAddClient(c => {
var nodes = cluster.NodesUris();
var connectionPool = new StaticConnectionPool(nodes);
var settings = new ConnectionSettings(connectionPool).EnableDebugMode();
return new ElasticClient(settings);
});
}
private ElasticClient Client { get; }
[I]
public void SomeTest() {
var rootNodeInfo = this.Client.RootNodeInfo();
rootNodeInfo.Name.Should().NotBeNullOrEmpty();
}
}
} My project file: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Elastic.Elasticsearch.Xunit" Version="0.2.4" />
<PackageReference Include="NEST" Version="7.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="FluentAssertions" Version="5.1.2" />
</ItemGroup>
</Project> I've also tried updating the versions of |
any news on this? I am experiencing exactly the same issue. @jpdunn , @Blueknight10001 have you been able to somehow resolve the problem? for me I was able to resolve it by downgrading xunit references to:
|
Also curious about the progress of this issue? Using xunit 2.4.x doesn't seem to find any tests but using 2.3.1 as stated above works fine? |
I can confirm this is a problem with xUnit 2.4.X (Visual Studio 2019) that seems to work fine with 2.3.1. |
Hi, I found solution :)
Should be:
Should be:
All my tests are green. The versions of the packages that I use today are the newest.
|
When writing test classes and using the line
[assembly: Xunit.TestFramework("Elastic.Xunit.Sdk.ElasticTestFramework", "Elastic.Xunit")]
, none of the tests (even the non Elastic tests) are discovered. I'm sure it's something simple I'm missing, but I can't find anything. I've used Visual Studio 2019 and the command line to no avail.It's almost an exact copy of the ExampleMinimal.
The text was updated successfully, but these errors were encountered: