Skip to content

Able to continue tests if one fails #641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2023
Merged

Conversation

chkuang-g
Copy link
Collaborator

Add new property CONTINUE_ON_FAIL_FOR_TESTS_ENABLED. When set to 1, if one test fails, the build script will continue running the next test and provide a final report when all tests are finished.

This currently works for

  • Unity Integration tests
  • Python tests

This does not work for

  • Gradle test, ex. testDownloadArtifacts
  • NUnit test

Add new property `CONTINUE_ON_FAIL_FOR_TESTS_ENABLED`. When set
to `1`, if one test fails, the build script will continue running
the next test and provide a final report when all tests are finished.

This currently works for
- Unity Integration tests
- Python tests

This does not work for
- Gradle test, ex. `testDownloadArtifacts`
- NUnit test
@chkuang-g chkuang-g requested a review from a-maurice September 20, 2023 14:48
@@ -1173,8 +1196,15 @@ Task createUnityTestTask(String taskName, String description,
setupTestProject.ext.projectDir.name,
setupTestProject.ext.containerDir,
additionalArguments, batchMode,
createTaskClosure)
createTaskClosure,
true)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be continueOnFailForTestsEnabled (or something equivalent)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.

I think it is easier to implement a consistent behavior if we always use EvaluateTestResult to handle whether the test should continue or not. That is

  • When continueOnFailForTestsEnabled is false (or 0), when a test fails, EvaluateTestResult() logs the result and throws an exception to terminate the run, which results in a return code -1
  • When continueOnFailForTestsEnabled is true (or 1), when a test fails, EvaluateTestResult() logs the result. And in the end, reportAllTestsResult task summarizes the result from every test. If any fails, it throws an exception to end the run, which results in return code -1.

I think this works better no matter one uses ./gradlew test to run every tests or use ./gradlew :testExportUnityPackage to run a specific test. The result reporting will be more consistent.

@chkuang-g chkuang-g merged commit 5fa2aec into master Sep 21, 2023
@chkuang-g chkuang-g deleted the process/test-terminate-option branch September 21, 2023 08:06
@googlesamples googlesamples locked and limited conversation to collaborators Oct 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants