Rider only discovers tests after restarting Rider
Tested IDEs: Rider 2025.1.1 Rider 2024.3.7
The green "run" button does not appear after writing a new test. However, when restarting the IDE it does appear.
Relevant settings:
Example of the green button appearing after restart:
I wasn't sure if I should report this as a TUnit issue or Rider issue, so I'm reporting it both places.
It'll be a rider issue. The green play may/should appear after building after writing a new test. But yeah rider would need to make some bespoke functionality to detect tests without a build.
I also use Rider, generally I find it works if you build first, but yeah, it can't discover the new test until you build.
My experience is also that with 2025.1.2 tests get discovered after build and you get the green play button and can jump to the tests from test explorer. Sometimes you need to close the file though.
However, there is one exception. If you have added the ClassDataSource attribute to the test class, then the tests in the class will still appear in the explorer and you can run them from there, but navigation to the test does not work, the green button do not appear and also keyboard shortcuts to run the tests do not work:
// Has issues with Rider test tooling
[ClassDataSource<Fixture>(Shared = SharedType.PerTestSession)]
public class ExampleTest
{
private readonly Fixture _fixture;
public ExampleTest(Fixture fixture)
{
_fixture = fixture;
}
[Test]
public async Task Test()
{
var actual = _fixture.Value;
await Assert.That(actual).IsLessThan(2);
}
}
To work around I've been setting the fixture to a property instead, so something like:
// Tests get discovered and can be navigated to
public class Example2Test
{
[ClassDataSource<Fixture>(Shared = SharedType.PerTestSession)]
public required Fixture Fixture { get; init; }
[Test]
public async Task Test()
{
var actual = Fixture.Value;
await Assert.That(actual).IsLessThan(2);
}
}
Visual Studio does not seem to suffer from same problem, so assuming this is also just a Rider specific issue, but thought I'd share this in case anyone else is running into this inconvenience.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.