Skip to content
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

Abort the job on the main thread if the test suite fails #32

Conversation

gbm25
Copy link
Member

@gbm25 gbm25 commented Dec 9, 2023

Update to Test Suite Fail-Fast Behavior

Summary

This PR implements key enhancements to the fail-fast behavior of our custom test suite, as discussed in the #27 issue threads. The focus is on refining the test execution strategy and preparing for future enhancements.

Key Changes

  1. Fail-Fast Behavior Enhancement: The RUN_TESTS function has been updated to support a new parameter for fail-fast configuration, allowing users to specify their preferred test execution strategy. The function now operates in three modes, governed by the TestRunBehavior enum:

    • CONTINUE_ON_ERROR: Continues executing tests after failures.
    • HALT_SUITE_ON_FAIL: Halts the current test suite on failure and proceeds to the next.
    • ABORT_ALL_ON_FAIL (Default Mode): Aborts all tests immediately upon any failure.
  2. Future Enhancements Acknowledged: While the immediate focus is on enhancing the fail-fast behavior, we acknowledge the postponed feature of controlling behavior via command line. Future enhancements, such as output grouping and color styling, are also noted for consideration in subsequent updates.

Conclusion

These updates make our test suite more adaptable and aligned with testing practices. The default mode ABORT_ALL_ON_FAIL ensures immediate attention to critical failures, enhancing the development and debugging process.

More tests and another suite case have been added to test the different RUN_TESTS options.
Bugs that prevented compilation have been fixed. ENUM TestRunBehavior names have been changed and relevant documentation has been added.
An output has been added in the FreeTest in case of error and with behavior "ABORT_ALL_ON_FAIL".
Se ha movido y modificado el output de error en caso de error en freetest con el modo 'ABORT_ALL_ON_FAIL'. Se ha añadido output de warning en caso de error en freetest con el modo 'HALT_SUITE_ON_FAIL'.
The code in which the suite tests were processed has been moved to its own function.
In case of an error in the tests an exception is thrown. This exception is thrown at different times depending on the error mode used.
Added output when a test fail on a suite on HALT_SUITE_ON_FAIL mode. Reformat file.
Fixed a bug on ABORT_ALL_ON_FAIL mode when a test fails in a suite. Added output.
Using Default value on RUN_TESTS(). Added comments.
The exception is eliminated in favor of exit(1) since error output is already returned.
The test suite documentation has been updated, adding information on test execution modes. Updated the example of use with more tests, to be able to see more clearly how the modes work in the result images.
The old example image of the output of the previous example code in the README is removed, as it does not reflect the actual code written and the modes are not reflected.
Due to an oversight this information had not been added in one of the previous commits.
@gbm25 gbm25 marked this pull request as ready for review December 16, 2023 20:32
@TheRustifyer TheRustifyer merged commit dc535c4 into zerodaycode:main Dec 16, 2023
1 check passed
@gbm25 gbm25 deleted the 27-abort-the-job-on-the-main-thread-if-the-test-suite-fails branch December 16, 2023 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request test-suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants