[Unity Test Runner] Launch GameMode Test from Command Line

Hello everyone !

There are two kinds of tests runnable using Unity Test Runner framework :
My assumptions about theses modes are :

  • GameMode : scene and Monobehaviour testing
  • EditMode : legacy NUnit testing

I want to use Hudson in order to enjoy Continuous Integration in my custom project. Therefore, I need to run tests from my CI server. The only way I found is to run tests from command line.

I read that we could run tests from command line using the -runEditorTests argument.
When I use this command :
“D:\Apps\Unity\Editor\Unity.exe” -runEditorTests -projectPath %WORKSPACE%\P101 -editorTestsResultFile %WORKSPACE%\P101\TestResults\DataGenerationTestResults.xml -logFile %WORKSPACE%\P101\Logs\test.log -batchmode

For your information, the %WORKSPACE% environment variable is working as every other step (such as build the app) works on Hudson. Paths to project/logs/results are ok too.

The issue is that Unity Test Runner runs only EditMode tests. I did not find any answer about GameMode tests using command line. Plus, the documentation about Unity Test Runner (link : Unity - Manual: Unit Testing) looks outdated.

Any idea about how can I run GameMode tests using a command line instruction ?

Thanks in advance,
Jordan

Try:

Unity.exe -projectPath -batchmode -runTests -testPlatform playmode -testResults \testresults.xml

You might also need to add:

-testFilter “/Library/ScriptAssemblies/Assembly-CSharp.dll”

Because of: Unit Test Runner Window does not detect TestFixtures - Unity Engine - Unity Discussions