-
Notifications
You must be signed in to change notification settings - Fork 80
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
StopOnFail doesn't seem to be supported in net core test runner #189
Comments
I also want to see this added. Struggled for 2 hours and giving up now. |
In addition, I can't get this to work either: {
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json",
"parallelizeTestCollections": false,
"parallelizeAssembly": false,
"stopOnFail": true
} The schema does not inlcude |
That is correct, the current schema (as of today) does not support stop-on-fail. |
@bradwilson, I upgraded to 2.5.0 and have this {
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json",
"parallelizeTestCollections": false,
"parallelizeAssembly": false,
"stopOnFail": true
} ![]() Test runner is not stopping on the first failure. What could I be missing? |
@tig I'll see if I can come up with a repro. |
@tig Here's my first repro attempt. I created three test classes. Each has 5 failing tests and 20 passing tests (due to randomization we don't know in what exact order things will be run, so I wanted to have a good baseline for "some test somewhere in the middle should fail"). I used your Here's the result: In the first class it chose to run, it managed to run 7 passing tests before hitting a failing test. It then stopped running all tests. So we get 7 passes, 1 fail, and 67 not run. This is precisely the behavior I would've expected. It looks like you're using the Resharper runner. I cannot account for which features they do and do not support. I can guess that support for Are you using Visual Studio? If so, does the behavior differ if you use Test Explorer instead of the Resharper test runner? |
Thanks for looking into this Brad. Just to ensure it wasn't Resharper I did the following on a machine that does not have Reshaper installed: git clone tig:gui-cs\Terminal.Gui
cd Terminal.Gui Added Updated xunit in <PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0"> Changed a unit test to using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Xunit.Abstractions;
// Alias Console to MockConsole so we don't accidentally use Console
using Console = Terminal.Gui.FakeConsole;
namespace Terminal.Gui.DriverTests {
public class ConsoleDriverTests {
readonly ITestOutputHelper output;
public ConsoleDriverTests (ITestOutputHelper output)
{
this.output = output;
}
[Theory]
[InlineData (typeof (FakeDriver))]
//[InlineData (typeof (NetDriver))]
//[InlineData (typeof (CursesDriver))]
//[InlineData (typeof (WindowsDriver))]
public void Init_Inits (Type driverType)
{
Assert.Fail ("testing xunit stoponfail");
} dotnet test -v Detailed Got this: I also tried same with Test Explorer and got same result; all tests were run even after the one with |
@tig You're missing step 2 of the configuration file instructions: https://xunit.net/docs/configuration-files#file This means that |
OFFS! This has been this way for years! Egads, that's embarrassing. |
@bradwilson Do you know if there's a way for us to set We definitely want it there, but not necessarily when doing local dev work. |
At the moment, there isn't a way short of swapping in a different |
‘sed -i 's/"stopOnFail": false/"stopOnFail": true/g' ./UnitTests/xunit.runner.json‘ |
@tig The next prerelease build of |
I am not sure if this is a limitation of dotnet test but I cannot get xunit.execution.StopOnFail to work with the dotnet test command line. I tried --stoponfail=true and - xunit.execution.StopOnFail=true but none of these are actually stopping the execution after the first failed test.
The text was updated successfully, but these errors were encountered: