ETSI's Bug Tracker - Ext Pack: Object-oriented features (ES 203 790)
View Issue Details

ID | Project | Category | View Status | Date Submitted | Last Update
0007561 | Ext Pack: Object-oriented features (ES 203 790) | [All Projects] General | public | 07-12-2016 16:34 | 18-04-2018 09:52

Reporter | Jacob Wieland - Spirent |
Assigned To | KristÃ³f Szabados |
Priority | normal | Severity | minor | Reproducibility | have not tried
Status | closed | Resolution | fixed |
Platform |  | OS |  | OS Version |
Product Version |  |
Target Version |  | Fixed in Version |  |

Summary | 0007561: Allow finally block or shutdown hook

Description

At the moment, it is not possible for a test case (or a behavior in general) to clean up after itself in case that it does not terminate but is stopped from the outside (either by the control part that started it due to timeout or if testcase.stop is called or if some testcase error occurs).
Consider a testcase that stores some information in a database (or the cloud) and at the end wants to remove that information again, so it can be run again. At the moment, if anything goes wrong in the testcase, no cleanup inside the testcase is possible anymore, so that needs to be shifted into the test adaptation or to the beginning of the testcase into some cleanup-preamble. All these approaches have the drawback that they are not explicit and information about what to clean up needs to flow either to the adaptation or to the next invocation of the testcase.
To avoid such obvious workarounds, we should introduce a concept of statements that are executed whenever a testcase/component/behavior ends.
One idea would be the introduction of a *finally* block which can be the last statement of the testcase body:
testcase T() ... {
var charstring cleanupId;
...
finally {
cleanup(cleanupId);
}
}
Another idea would be the resgistration of a shutdown hook similar to the activate statement (or the activate statement could be enhanced for this capability) that is invoked whenever a component terminates or dies. Of course, that shutdown hook can only access the component variables while the finally block could also access the local variables.

Steps To Reproduce |
Additional Information |
Tags | No tags attached.

Relationships

related to | 0007692 | closed | KristÃ³f Szabados | Exception handling with less code and less performance overhead
related to | 0007731 | closed | Jens Grabowski | Draft document for Object-oriented Extension

Attached Files |

Issue History
Date Modified | Username | Field | Change
07-12-2016 16:34 | Jacob Wieland - Spirent | New Issue |
06-06-2017 15:09 | Jens Grabowski | Assigned To | => Jens Grabowski
06-06-2017 15:09 | Jens Grabowski | Status | new => assigned
06-06-2017 15:10 | Jens Grabowski | Note Added: 0014635 |
27-07-2017 15:45 | Jens Grabowski | Project | Part 01: TTCN-3 Core Language => Ext Pack: Object-oriented features (ES 203 790)
27-07-2017 15:45 | Jens Grabowski | Category | New Feature => General
28-07-2017 12:28 | Jens Grabowski | Assigned To | Jens Grabowski => Kristof.Szabados
28-07-2017 12:29 | Jens Grabowski | Relationship added | related to 0007692
28-07-2017 12:40 | Jens Grabowski | Assigned To | Kristof.Szabados => KristÃ³f Szabados
27-10-2017 11:23 | KristÃ³f Szabados | Note Added: 0014911 |
18-04-2018 08:34 | KristÃ³f Szabados | Relationship added | related to 0007731
18-04-2018 09:52 | KristÃ³f Szabados | Note Added: 0015097 |
18-04-2018 09:52 | KristÃ³f Szabados | Status | assigned => closed
18-04-2018 09:52 | KristÃ³f Szabados | Resolution | open => fixed

Notes

(0014635)
Jens Grabowski
06-06-2017 15:10

STF discussion: possible ways for implementation, e.g., exception handling, destructor (in OO)

(0014911)
KristÃ³f Szabados
27-10-2017 11:23

This CR will be resolved as part of CR7692

(0015097)
KristÃ³f Szabados
18-04-2018 09:52

Solved as part of the OO extension (CR 7731)