Skip to content

Commit

Permalink
added jvm-exit-hook.adoc
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Clemens Grosse authored and Clemens Grosse committed Feb 29, 2024
1 parent 12926ea commit cba5247
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 4 deletions.
1 change: 0 additions & 1 deletion docs/src/docs/execution.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ include::execution/execution-retry-analyzer.adoc[leveloffset=+1]
include::execution/execution-watchdog.adoc[leveloffset=+1]
include::execution/execution-annotation.adoc[leveloffset=+1]
include::execution/execution-dry-run.adoc[leveloffset=+1]
include::execution/execution-jvm-monitor.adoc[leveloffset=+1]
4 changes: 2 additions & 2 deletions docs/src/docs/extending-testerra/events-and-listener.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ This event can be used to send test results to a test management system or issue

| `ExecutionFinishEvent`
|Called at the end of test run to trigger report generation and other output worker.

[#ExecutionAbortEvent]
|`ExecutionAbortEvent`
|Called on test run abortion due to unclear circumstances like hanging sessions, JVM exit or other.
|Called on test run abortion due to unclear circumstances like hanging sessions, JVM exit or other. Used to create report with existing execution information.

|`InterceptMethodsEvent`
|Called before suite execution. The events methods list provides a list of tests to execute. Read more about this in <<Intercept test method execution>>
Expand Down
1 change: 1 addition & 0 deletions docs/src/docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ include::reports.adoc[leveloffset=+1]
include::modules.adoc[leveloffset=+1]
include::utilities.adoc[leveloffset=+1]
include::selenium4.adoc[leveloffset=+1]
include::jvm.adoc[leveloffset=+1]

'''
= Extending Testerra
Expand Down
4 changes: 4 additions & 0 deletions docs/src/docs/jvm.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
= JVM

include::jvm/jvm-monitor.adoc[leveloffset=+1]
include::jvm/jvm-exit-hook.adoc[leveloffset=+1]
7 changes: 7 additions & 0 deletions docs/src/docs/jvm/jvm-exit-hook.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[#JvmExitHook]
= JVMExitHook

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.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include::../properties/property-attributes.adoc[]

The `JVMMonitor` is the Observer of the hardware utilization for memory and cpu.
With the start of a test while using the `TesterraListener` the latter implicitly starts the `JVMMonitor`.
Thus a concurrent thread for monitoring purposes only is initiated next to the actual test execution. Every ten seconds the following parameters are logged
Thus a concurrent thread for monitoring purposes only is initiated next to the actual test execution. Every ten seconds the following parameters are logged at DEBUG Level.

* JVM Memory usage in MB
* JVM Memory reserved in MB
Expand Down
14 changes: 14 additions & 0 deletions docs/src/docs/reports/overview.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ The report is generated after the test execution and can be viewed with this htm
test-report/report-ng/index.html
----

[#ExecutionAbortion]
In case of unexpected abortion of a test execution the report is generated, too. . Due to abortion of still running test methods
some information can be missing, like result states or execution time.

Testerra additionally provides a mechanism to implicitly create a test report when an unexpected exit of the current execution occurred. All existing information created until the moment of the abortion are collected to generate a report.
This might lead to missing as information like the execution time, result states and screenshots might be abandoned if running test methods have been interrupted.

image::report-ng-24.png[align="center", alt="Report-NG states missing"]
image::report-ng-25.png[align="center", alt="Report-NG execution time missing"]

A hint indicating the possibly incomplete state of the report is shown as a warning in the section 'priority messages'.
The report generation in case of abortion of the test execution is described in detail in the paragraph <<#JvmExitHook, JVMExitHook>>.

image::report-ng-23.png[align="center", alt="Report-NG Aborted Exection"]

[IMPORTANT]
====
Expand Down
Binary file added docs/src/images/report-ng-23.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/images/report-ng-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/images/report-ng-25.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cba5247

Please sign in to comment.