unity-azure-pipelines-tasks icon indicating copy to clipboard operation
unity-azure-pipelines-tasks copied to clipboard

Handle Test Runner Exit code 2

Open bdovaz opened this issue 3 years ago • 2 comments

If you look at this page, they clearly put that if the exit code is 2 it means that the Unity process has been executed correctly but that some tests have failed.

I am requesting this change because otherwise it would not be possible to subsequently execute a task that publishes the test results including the failures to analyze the cause.

Sources:

I put a link from an old version of Unity because in the new one it does not appear:

https://docs.unity3d.com/530/Documentation/Manual/testing-editortestsrunner.html

I put a link to a third party repository because the source code of the test framework package is not public, you can see the code there:

https://github.com/needle-mirror/com.unity.test-framework/blob/master/UnityEditor.TestRunner/CommandLineTest/ExitCallbacks.cs#L24

https://github.com/needle-mirror/com.unity.test-framework/blob/master/UnityEditor.TestRunner/CommandLineTest/Executer.cs#L60

Looking at the code I see that this exit code is not managed and the task is directly marked as failed so it does not allow you to execute tasks later in the pipeline.

https://github.com/Dinomite-Studios/unity-azure-pipelines-tasks/blob/main/Tasks/UnityTest/UnityTestV1/unity-test.ts#L117

bdovaz avatar Jan 14 '21 18:01 bdovaz

Thank you @bdovaz for the detailed explaination. This change makes a lot of sense.

FejZa avatar Jan 16 '21 09:01 FejZa

@FejZa I'm glad you have implemented this functionality but I would make two small changes:

  • It should be configurable whether the task fails or not with exit code == 2.
  • In case the task is configured to not fail, it should set a variable with the result of the exit code so that it can be read later in the pipeline and react in some way.

bdovaz avatar Apr 20 '21 22:04 bdovaz