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

Feature/generate report on interruption #397

Merged
merged 9 commits into from
Mar 4, 2024

Conversation

clemensgrosse
Copy link
Collaborator

Description

Added mechanism to generate a report in case of unexpected abortion of test execution.
A ShutDownHook triggers on JVM finish in successful and failure cases. Report generation is then triggered within the Hook, if no report has been generated before. with sending a ExecutionAbortEvent.
Flag for generated report is set once only in ExecutionEndListener, in case of successful end of test execution (ExecutionFinishEvent received by the mentioned Listener).

Type of change

  • [x ] New feature (non-breaking change which adds functionality)

Checklist:

  • [x ] My code follows the style guidelines of this project
  • [ x] I have performed a self-review of my own code
  • [ x] I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • [x ] My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • [x ] New and existing tests pass locally with my changes
  • [ x] Any dependent changes have been merged and published in downstream modules

Clemens Grosse added 3 commits February 23, 2024 15:44
registered JVMExitHook as new shutdownHook in Testerra;
removed deprecated Code in TesterraListener;
added log message in ExecutionEndListener:
mreiche
mreiche previously approved these changes Feb 26, 2024
@martingrossmann
Copy link
Contributor

The information that a test is crashed is never used. We should add a notice to the report.

I think we can add something like that in ExecutionEndListener.finalizeExecutionContext before printExecutionStatistics():

if (contextController.getExecutionContext().isCrashed()) {
    log().warn("Test execution was aborted. Test results may be imcomplete.", Loggable.prompt);
}

added log message in case of execution abortion in ExecutionEndListener;
@martingrossmann
Copy link
Contributor

As discussed please add a short note in documentation about this helpful feature.

mreiche
mreiche previously approved these changes Feb 29, 2024
added paragraph on aborted execution in overview.adoc;
added screenshots report-ng-23.png, report-ng-24.png, report-ng-25.png;
removed jvm-monitor section in execution.adoc;
included new JVM section in index.adoc;
updated jvm-monitor.adoc;
added reference to ExecutionAbortionEvent
Clemens Grosse added 2 commits February 29, 2024 13:20
@clemensgrosse clemensgrosse requested a review from mreiche March 1, 2024 06:30
The `JVMExitHook` was integrated to achieve the generation of a report with Report-NG in case an <<#ExecutionAbortion, aborted test run>>. With the start of a test execution the `JVMExitHook` is added as a shutdown hook to the JVM.

When the JVM is about to stop, shutdown hooks are always called by default. This includes cases of abortion, all other system errors and normal finish. In the latter case a flag indicating an already created report is set true once in the process of the report generation.
To avoid overriding the already existing report, the `JVMExitHook` only triggers when this flag is false, as this is the only indicator of an unexpected exit and a missing report. It then sends the <<#ExecutionAbortEvent, ExecutionAbortEvent>>, which is then caught by the corresponding listeners creating a report.
Copy link
Contributor

Choose a reason for hiding this comment

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

Your link to ExecutionAbortEvent does not work anymore because it's an own chapter now. ;-)

mreiche
mreiche previously approved these changes Mar 1, 2024
coorrect reference to link of abortion event in jvm-exit-hook.adoc;
@martingrossmann martingrossmann merged commit 1f4a19b into master Mar 4, 2024
@martingrossmann martingrossmann deleted the feature/generate-report-on-interruption branch March 4, 2024 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants