You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since we are targeting multiple platforms with several different defines (such as #if UNITY_IOS and #if UNITY_ANDROID) in our code base I would like to run tests while targeting these platforms. Currently only the UNITY_LINUX_STANDALONE define is set when running tests on an ubuntu runner.
This would make it so much easier to catch those simple compile mistakes when PR's lands too.
Suggested solution
I suggest that -targetPlatform is added as an option. This option would then require the unity project to have a static RunTest (or something similar) method also defined in a -testMethod option (similar to how -buildMethod works for game-ci/unity-builder).
That testMethod would then need to look something like this (in an editor folder):
public static void RunTest()
{
var testRunnerApi = ScriptableObject.CreateInstance<TestRunnerApi>();
var filter = new Filter()
{
testMode = GetTestMode("-testPlatform"),
targetPlatform = GetBuildTarget("-targetPlatform")
};
testRunnerApi.Execute(new ExecutionSettings(filter));
}
Thanks for creating this issue. We agree this would be nice to have as well.
If I remember correctly, this has been requested before but no pull request was ever created.
Note that it's not the ubuntu runner that decides which platforms are available, but the docker image that's used inside the action. Unity-builder already supports multiple targetPlatforms (most can be used without having to change runner type).
In test runner currently there's only customImage, which can be used to use the iOS, Android or other image (see versions for the respective image tags). I believe this was already enough for the people that needed this, though ultimately we'd want to support a parameter targetPlatform exactly in the same way as we do in unity-builder.
Context
Since we are targeting multiple platforms with several different defines (such as
#if UNITY_IOS
and#if UNITY_ANDROID
) in our code base I would like to run tests while targeting these platforms. Currently only theUNITY_LINUX_STANDALONE
define is set when running tests on an ubuntu runner.This would make it so much easier to catch those simple compile mistakes when PR's lands too.
Suggested solution
I suggest that
-targetPlatform
is added as an option. This option would then require the unity project to have a staticRunTest
(or something similar) method also defined in a-testMethod
option (similar to how-buildMethod
works for game-ci/unity-builder).That testMethod would then need to look something like this (in an editor folder):
Additional details
https://docs.unity3d.com/Packages/[email protected]/manual/extension-run-tests.html
The text was updated successfully, but these errors were encountered: