Skip to content
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

Run .NetCore 2.0 test from command line #458

Closed
nbns opened this issue Aug 21, 2018 · 4 comments
Closed

Run .NetCore 2.0 test from command line #458

nbns opened this issue Aug 21, 2018 · 4 comments
Labels

Comments

@nbns
Copy link

nbns commented Aug 21, 2018

I have two prjects my library and test.
The test library contains only a simple test and reference to my library

    [TestFixture]
    class Class1
    {
        [Test]
        public void simple_test_false()
        {
            Assert.IsFalse(false, "false");
        }
    }

Nuget packages installed for the test project:

  • nunit" Version="3.10.1"
  • NUnit3TestAdapter "3.10.0"
  • Microsoft.NET.Test.Sdk 15.8.0"

dotnet verion 2.1.400

Running test from Visual Studio Test Explorer (2017), everything works fine, but when I running its from console I have the following output:

Build started, please wait...
Build started, please wait...
Build completed.

Test run for d:\dev\testlib\src\testlib\bin\Debug\netstandard2.0\TestLib.dll(.NETStandard,Version=v2.0)
Microsoft (R) Test Execution Command Line Tool Version 15.8.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
System.IO.FileNotFoundException: Unable to find tests for d:\dev\testlib\src\testlib\bin\Debug\netstandard2.0\TestLib.dll. Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk" and framework version settings are appropriate. Rerun with /diag option to diagnose further.
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostProcessStartInfo(IEnumerable`1 sources, IDictionary`2 environmentVariables, TestRunnerConnectionInfo connectionInfo)
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources)
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyExecutionManager.StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsHandler eventHandler)

Test Run Aborted.
Build completed.

Test run for d:\dev\testlib\test\TestLib.Test\bin\Debug\netcoreapp2.0\TestLib.Test.dll(.NETCoreApp,Version=v2.0)
Microsoft (R) Test Execution Command Line Tool Version 15.8.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...

Total tests: 1. Passed: 1. Failed: 0. Skipped: 0.
Test Run Successful.
Test execution time: 1,2002 Seconds

How to get rid of this error?

Sorry for my English.

@mikkelbu
Copy link
Member

Hi @b7ns
Can you provide the exact command you use to run the tests. Currently, I only see the output. That being said it looks like an error in dotnet test (see microsoft/vstest#1129).

@rprouse
Copy link
Member

rprouse commented Aug 22, 2018

@b7ns are your tests multi-targeted? The Test run for d:\dev\testlib\src\testlib\bin\Debug\netstandard2.0\TestLib.dll(.NETStandard,Version=v2.0) seems odd. Tests must target .NET Core or full framework. Can you copy in the CSPROJ file you are using?

@nbns
Copy link
Author

nbns commented Aug 22, 2018

Thanks @mikkelbu
It's my fault.
Yes, I ran the test command in the solution folder. When I run in the test folder, It's all right.

@nbns nbns closed this as completed Aug 22, 2018
@mikkelbu
Copy link
Member

@b7ns are your tests multi-targeted? The Test run for d:\dev\testlib\src\testlib\bin\Debug\netstandard2.0\TestLib.dll(.NETStandard,Version=v2.0) seems odd. Tests must target .NET Core or full framework. Can you copy in the CSPROJ file you are using?

Note that it says

Test run for d:\dev\testlib\src\testlib\bin\Debug\netstandard2.0\TestLib.dll(.NETStandard,Version=v2.0)
...
Test run for d:\dev\testlib\test\TestLib.Test\bin\Debug\netcoreapp2.0\TestLib.Test.dll(.NETCoreApp,Version=v2.0)

so my guess was that TestLib.dll is the production assembly and TestLib.Test.dll the test assembly.

@mikkelbu mikkelbu added this to the Closed Without Action milestone Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants