-
Notifications
You must be signed in to change notification settings - Fork 330
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
Migrate from xUnit to NUnit #79
Conversation
@leasunhy, |
Looking good, please do some testing with coreclr. Thanks! |
tests/xunit2nunit.sed
Outdated
s@InlineData@TestCase@g | ||
s@Fact@Test@g | ||
s@using Xunit@using NUnit.Framework@g | ||
s@Assert.Equal@Assert.AreEqual@g |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO add Assert.True -> Assert.That
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Support for coreclr blocked due to nunit/nunit3-vs-adapter#313. |
@leasunhy are you sure about this? IIRC nunit has always been working with |
{ | ||
if (args.Length < 2) | ||
{ | ||
Console.Error.WriteLine("Usage: runner <runner-path> <test-assembly> <result-dir> [nunitlite-arg ..]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is runner-path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The testing process for one test assembly is:
- Meta-runner scans the test assembly and get the list of tests.
- Meta-runner starts a test-runner for each test in the test assembly.
- (TODO) Merge the result XML files into one.
... where, the path of the test-runner is specified in runner-path.
var assemblyPath = Path.GetFullPath(args[2]); | ||
var remainingOptions = args.Skip(3).ToArray(); | ||
|
||
// NOTE(leasunhy): this may fail silently if some of the dependencies are not preloaded! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no exceptions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, in our scenario, when NUnit is not preloaded, it will throw an exception, but when Trinity is not preloaded, it will succeed but no tests can be discovered.
|
||
foreach (var testName in allTestNames) | ||
{ | ||
var process = CreateProcessForTest(runnerPath, assemblyPath, resultDirPath, remainingOptions, testName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO we'd better add a timeout limit (for example 30mins). IIRC NUnitLite has this feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
The |
OK, actually NUnit on .NET Core does not support Timeout at all. Even |
@leasunhy agreed. A bit of a hack, but see: https://github.com/dotnet/coreclr/blob/master/tests/src/baseservices/threading/regressions/threadex.cs In the inner meta runner process, setup a timer event, which sends abort to record the test results. |
@@ -47,7 +51,7 @@ public static int Main(string[] args) | |||
|
|||
foreach (var testName in allTestNames) | |||
{ | |||
var process = CreateProcessForTest(runnerPath, assemblyPath, resultDirPath, remainingOptions, testName); | |||
var process = CreateProcessForTest(runnerPath, assemblyPath, resultDirPath, runnerOptions, testName); | |||
process.WaitForExit(); | |||
Console.WriteLine(process.StandardOutput.ReadToEnd()); | |||
// TODO(leasunhy): check the exit status of the process and regard the test as a failure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just don't forget to add this feature :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, which feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exit code
This PR deprecates xUnit in favor of NUnit.
test.csproj
.test_coreclr.csproj
.