mardi 12 avril 2016

Run NUnit tests in dotnet core

I am trying to run unit tests for my c# project with dotnet core. I am using docker container for runtime.

Dockerfile

FROM microsoft/dotnet:0.0.1-alpha
RUN mkdir /src
WORKDIR /src
ADD . /src
RUN dotnet restore

"NUnit" and "NUnit.Runners" have been added into project.json

"version": "1.0.0-*",
"compilationOptions": {
    "emitEntryPoint": true
},

"dependencies": {
    "NETStandard.Library": "1.0.0-rc2-23811",
    "NUnit": "3.2.0",
    "NUnit.Runners": "3.2.0"
},
"frameworks": {
    "dnxcore50": { }
}

Run dotnet restore successfully with the following output

...
log  : Installing NUnit.ConsoleRunner 3.2.0.
log  : Installing NUnit.Extension.NUnitV2ResultWriter 3.2.0.
log  : Installing NUnit.Extension.NUnitV2Driver 3.2.0.
log  : Installing NUnit.Extension.VSProjectLoader 3.2.0.
log  : Installing NUnit.Extension.NUnitProjectLoader 3.2.0.
log  : Installing NUnit.Runners 3.2.0.
info : Committing restore...
log  : Restore completed in 4352ms.

tried to run the tests with

dotnet nunit

dotnet nunit-console

Not work.

So my questions is how am I going to call the runner? Or can someone suggest another unit testing framework that works with current version of dotnet core?

Appreciate any help that you can provide. Thank you!

Aucun commentaire:

Enregistrer un commentaire