IMK
IMK

Reputation: 718

Display a notification for the testcase been executed using cake script

I'm using the below cake script to run my NUnit test suite project. I am using PowerShell for execution. I have over 17000 NUnit test cases and it cases waiting for a long time over a blank screen. I like to get a notification in PowerShell about which test-case is been currently executed.

Task("Run-Unit-Tests")
.Does(() =>
{
if(IsRunningOnWindows())
{
    MSBuild(currentDirectory + "./Test/NUnit_Example.csproj", settings =>
    settings.SetConfiguration(configuration).AddFileLogger(new MSBuildFileLogger() ));
}
});

I am expecting something like the below,

"TestCase_1" is completed
"TestCase_2" is in progress

Forget about the combinations for each test case.Just displaying the name of the test case which currently been executed is enough.

How to do this?

Upvotes: 1

Views: 115

Answers (1)

devlead
devlead

Reputation: 5010

I suppose you running tests as a MSBuild task? If you instead use the console runner you'll get more console output, example usage:

#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.0

Task("Run-Unit-Tests")
    .IsDependentOn("Build")
    .Does(() =>
{
    NUnit3("./src/**/bin/" + configuration + "/*.Tests.dll",
        new NUnit3Settings {
            NoResults = true
        });
});

You can find a complete example here.

Upvotes: 2

Related Questions