Sakamoto Kazuma
Sakamoto Kazuma

Reputation: 2579

Cake Running Nunit 3 using DotNetCoreTest Is Failing

Task("Nunit")
.Does(() => {
    DotNetCoreTest("D:\Workspace\Proj14\test\test\WebAutomation\NUnit\UserManageLMTWS.cs", );
    });

Currently have by build.cake defining the task as such as listed in the https://cakebuild.net/api/Cake.Common.Tools.DotNetCore/DotNetCoreAliases/8191BBC4 example. I don't have any settings, as I guess I'm building into Debug instead of Release, but I am getting the following errors when running the task:

Error: Bootstrapping failed for 'D:/Workspace/Proj14/test/test/Nunit'.
Nunit, line #0: Could not find script 'D:/Workspace/Proj14/test/test/Nunit'.

Do I need to pass NUnit into the DotNetCoreTest method somehow?

Upvotes: 0

Views: 1000

Answers (1)

devlead
devlead

Reputation: 5010

DotNetCoreTest is meant to test projects and not individual files.

So you specify either the <PROJECT> | <SOLUTION> | <DIRECTORY> file i.e.

  • DotNetCoreTest("./test/Project.Tests/", settings);
  • DotNetCoreTest("./test/My.sln", settings);
  • DotNetCoreTest("./test/Project.Tests/Project.Tests.csproj", settings);

DotNetCoreTest calls to the .NET SDK CLI command dotnet test.

The error you're receiving though is because the path to the specified script is wrong / doesn't exist. There's no file called D:/Workspace/Proj14/test/test/Nunit which is why error message says Could not find script 'D:/Workspace/Proj14/test/test/Nunit'

Upvotes: 3

Related Questions