NUnit3Runner does not work with dot net core 2.1 #3131
Replies: 13 comments 6 replies
-
For .NET Core / .NET 5 projects I would recommend using the .NET CLI Test command using the DotNetCoreTest alias. |
Beta Was this translation helpful? Give feedback.
-
My project is dot net core 2.1 |
Beta Was this translation helpful? Give feedback.
-
The .NET Core / 5 SDK exists for You can install SDKs side by side, and they're often installed by the Visual Studio installer, so you've probably already have the SDK with If not you can either install via Visual Studio installer or get.dot.net. |
Beta Was this translation helpful? Give feedback.
-
@devlead I found if I use below command
our test is running, but I have one problem with this, that I cannot specify results path like NUnit3Settings, Did you have any idea to resolve my problem? |
Beta Was this translation helpful? Give feedback.
-
@devlead I cannot use thanks for response |
Beta Was this translation helpful? Give feedback.
-
The VSTest alias VSTestSettings has a Logger property. You could set it to something like |
Beta Was this translation helpful? Give feedback.
-
@devlead Thanks a lot for response, but your solution does not specify result directory as you can see https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options?view=vs-2019
Is there anyway to set ResultDirectory? |
Beta Was this translation helpful? Give feedback.
-
@devlead I use ArgumentCustomization for resolve my problem, But I think this issue is not close, because NUnit3 has Bug for working with dot net core 2.1 I think it is sound good to add ResultDirectory to VSTestSettings thanks a lot for helping me |
Beta Was this translation helpful? Give feedback.
-
@devlead HandleExitCode does not work for VSTest, What did i do can? I set HandleExitCode = _ => true but I got
I found one link maybe can help as you can see in link this tools have settings that name Update: I found my problem, HandleExitCode is correct but my problem is VSTest write standard error when any test failed |
Beta Was this translation helpful? Give feedback.
-
Link to #3127 |
Beta Was this translation helpful? Give feedback.
-
@soroshsabz Could you provide a reproducible example (Visual Studio project + build.cake file) that causes this error? I am not able to repro the error you mention when setting var settings = new VSTestSettings
{
HandleExitCode = _ => true,
};
VSTest(@"C:\augustoproiete\repro-cake-3123\bin\Debug\netcoreapp3.1\UnitTestProject1.dll", settings); using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestProject1
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
throw new InvalidOperationException("boom");
}
}
} Compiling build script...
Resolved tool to path C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/TestWindow/vstest.console.exe
Executing: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/TestWindow/vstest.console.exe" "C:/augustoproiete/repro-cake-3123/bin/Debug/netcoreapp3.1/UnitTestProject1.dll"
Microsoft (R) Test Execution Command Line Tool Version 16.8.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Failed TestMethod1 [17 ms]
Error Message:
Test method UnitTestProject1.UnitTest1.TestMethod1 threw exception:
System.InvalidOperationException: boom
Stack Trace:
at UnitTestProject1.UnitTest1.TestMethod1() in C:\augustoproiete\repro-cake-3123\UnitTestProject1\UnitTest1.cs:line 12
Test Run Failed.
Total tests: 1
Failed: 1
Total time: 0.7013 Seconds
C:\augustoproiete\repro-cake-3123>echo %ERRORLEVEL%
0 |
Beta Was this translation helpful? Give feedback.
-
@augustoproiete As I update my comment, I found my problem, and HandleExitCode is correct sorry for that :( |
Beta Was this translation helpful? Give feedback.
-
I think my problem still exist, NUnit3 runner must be work properly with dot net core project, but at now this runner throw exception in this situation |
Beta Was this translation helpful? Give feedback.
-
ITNOA
What You Are Seeing?
When I was use
NUnit3(testProject.DllFilePath, settings)
with dot net core 2.1 project I got many exception.What is Expected?
NUnit3 work properly with any type of NUnit test project
What version of Cake are you using?
1.0.0
Are you running on a 32 or 64 bit system?
64 bit system
What environment are you running on? Windows? Linux? Mac?
Windows
Are you running on a CI Server? If so, which one?
No
How Did You Get This To Happen? (Steps to Reproduce)
Create dot net core 2.1 project with NUnit3 template from visual studio 2019 and then try run cake file with below command
NUnit3(testProject.DllFilePath, settings)
Output Log
Beta Was this translation helpful? Give feedback.
All reactions