Tomi
Tomi

Reputation: 3570

TestStack White - Run tests from command line

I'm looking for a solution to start my tests from command line.

When I try to start it from cmd like I would do with with regular Unit Tests, it is not working.
It says:

Starting execution...  
No tests to execute.

I build the project before I start 'Run UI Tests' stage.

Any ideas how to make it work? Could really find it on stackoverflow, github issues of TestStack nor other glory places on the web

Upvotes: 6

Views: 561

Answers (2)

Shiran Jayawardena
Shiran Jayawardena

Reputation: 509

nunit3-console is great alternative to MSTEST. Please refer below link.

e.g. nunit3-console \bin\Debug\Automation.dll --where "cat=Smoke-Tests"

https://github.com/nunit/docs/wiki/Console-Command-Line

Upvotes: 0

Tomi
Tomi

Reputation: 3570

Found a solution. On my local developer machine it was working, the mstest version was 14 On the build agent machine the mstest version was 15, that was not working somehow (it had nothing to do with TestStack White, simply the unit tests were not working)

What I do is, calling vstest.console.exe instead of the mstest.

C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe

So, instead of

stage('Run UI Tests') {
    steps {
        bat('"C:\\PATH_TO_MSTEST\\mstest" /testcontainer:PATH_TO_MY_TEST_PROJECT\\bin\\Debug\\MyTests.dll')
    }
}

My command in the Jenkinsfile was:

stage('Run UiTests') {
            steps {
                bat('"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\TestAgent\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe" PATH_TO_MY_TEST_PROJECT\\bin\\Debug\\MyTests.dll')
            }
        }

Upvotes: 2

Related Questions