I am running my unit tests in unity using the following command:
.\Unity.exe -runTests -projectPath path o\project -testResults path o\results.xml -testPlatform StandaloneWindows64
This successfully opens unity and the StandaloneWindows64 player, and claims the tests are being run successfully. However, the results.xml file claims that all the tests were skipped because they are not being run on the supported platform. When I run the tests from the Unity test runner, they are run successfully. I verified by adding failing unit tests and observing that they are run and reported as failing.
Each test uses this line (or similar) to restrict the platforms it can be run on:
[UnityPlatform(include = new[] {RuntimePlatform.WSAPlayerARM, RuntimePlatform.WSAPlayerX64, RuntimePlatform.WSAPlayerX86, RuntimePlatform.OSXPlayer, RuntimePlatform.Android})]
The Unity manual doesn’t include platforms like WSAPlatformX64
or similar in its documentation here, in the section “Running from the Command Line”.
Why does running tests from the command line as above not follow the same behavior as the “Run all in Player” button in Unity? How do I get the tests to run on the platform(s) I want to from the command line?
EDIT: (More information)
I’m running on Unity 2017.1.0p4. Here’s a section from the results.xml saying the test was skipped:
<test-case id="1005" ...(omitted)>
<properties>
<property name="_SKIPREASON" value="Only supported on WSAPlayerARM, WSAPlayerX64, WSAPlayerX86, OSXPlayer, Android" />
</properties>
<reason>
<message><![CDATA[Only supported on WSAPlayerARM, WSAPlayerX64, WSAPlayerX86, OSXPlayer, Android]]></message>
</reason>
</test-case>
When using “Run all in Player”, the platform is StandaloneWindows
.
EDIT 2:
Digging a little more, it seems I had my build settings wrong. The tests weren’t running. Now they are, but the command line tests still won’t. Basically I just want to use -testPlatform WSAPlayer*, but according to the documentation it doesn’t seem like that’s possible.