Cysharp / RuntimeUnitTestToolkit

CLI/GUI Frontend of Unity Test Runner to test on any platform.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support macOS test runner

stakemura opened this issue · comments

@neuecc
RuntimeUnitTestToolkit fails to run BuildRunTest on macOS due to lack of file extension .app.
I prepared PR #6 for resolve this case.

Unfortunately, Unity's BuildPipeline.BuildPlayer under headless mode doesn't seem to work on macOS, regardless of the file extension. If you have any idea, please let me know.

PS: Thank you for commit !

I thought Unity's BuildPipeline.BuildPlayer under headless mode doesn't work on macOS.
In fact, it is working.
Unlike Linux or Windows, macOS test runner doesn't show any log messages. Therefore I misunderstood.

If it doesn't output log, then that's a problem (can't know the test results!)
Now using Console.WriteLine, but if it doesn't work in macos-headless,
I'll add an option to turn it into an output via Debug.Log, how about that?

Thank you for your comment.
Unfortunately, Unlike Linux or Windows, macOS Unity couldn't export a console application and acts as a GUI application even under headless mode. So I guess the play-mode test code is required to export log files for CI purpose.

Thanks, I've understood it.

Is ExitCode works?
If so, I'll add -log(filePath) option and output to file,
after running .app, cat logs will be similar as other os.

I tried the following code on Unity 2018.4.12f1.

        [Test]
        public void TestSimplePasses()
        {
            Assert.Fail("assert");
        }
/Applications/Unity/Hub/Editor/2018.4.12f1/Unity.app/Contents/MacOS/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath **** -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend Mono2x /BuildTarget StandaloneOSX
open ****/test.app --args -batchmode
echo "exit code: $?"
> exit code: 0

OMG. ExitCode doesn't seem to work...

How about calling execution file directly from terminal?

You know, .app is just a macOS app symbol but shell can call it's binary like this. Both stdout and stderr wil show on terminal and can handle with pipe.

./test.app/Contents/MacOS/RuntimeUnitTestToolkit

image

Isn't it sufficient for CI or headless usage?

Here's exit code result. Exitcode 0 on success and 1 if failed.

image

image

You can find Pipe works without trouble.

$ ./test.app/Contents/MacOS/RuntimeUnitTestToolkit | grep NG
[NG]TestSimplePasses, NUnit.Framework.AssertionException: assert
Test Failed, please see [NG] log.

@guitarrapc I really appreciate your helpful comments!!! I'm glad I asked here.