ETSI's Bug Tracker - Part 01: TTCN-3 Core Language
View Issue Details
0007798Part 01: TTCN-3 Core LanguageNew Featurepublic21-09-2018 08:0708-01-2020 09:25
Jacob Wieland - Spirent 
Gyorgy Rethy 
normalminorhave not tried
closedfixed 
 
4.12.1 (published 2020-05) 
20.2, C.5
Spirent - Jacob Wieland
0007798: Address problems with implicit default alt invocation
There's some problems with default alts that sometimes lead to surprising/unexpected results for those developing testcases.

A very common pattern is:

t.start;
t.timeout;

Almost nobody expects default alternatives to be evaluated when checking for the timeout. But, if some default alternative like

alt { [] p.receive { repeat } }

is active, this will read all messages from the port p while waiting for the timeout (which might carry significance for the rest of the testcase).

Another of those patterns is

comp.start(..)
comp.done;

A similar problem is if there are multiple channels of communication like the sync communication between components or upper tester communication.
In such instances, while waiting for the answer on port p1, default alts reading messages from another port can influence the test result negatively.

A possible way to deal with this problem is to add boolean component variables and use them for all guards in default alternatives that should not be active all the time. It is then necessary to set/unset these flags before every alt statement.

Of course, this requires a lot of additional code and is very error prone if the number of flags gets bigger and possibly needs to be amended whenever a new default alternative is added to the testcase.

Ideas to address this problem:

1)
Default alternatives should be added a category upon activation and alt statements should allow giving one (or maybe a list) of such categories whose defaults should be active.

2)
For simple non-port alternatives (short form without syntactically enclosing alt like given above), normal defaults should either never be active (unless they are marked specially upon activation) or some modifier @nodefault could be placed in front of them to make it more explicit (to avoid backward incompatibility issues)

3)
Implicity deactivate all alternatives in defaults which do not deal with the entities in the non-default alt-part. E.g. if an alt statement only treats messages on port p (like the upper tester port), alternatives for ports mapped to the system under test should be inactive for the duration of that alt statement.

Of course, while option 3, in my opinion, would be the most logical solution wich requires the least amount of change by the users and as it is the closest to what people expect when they write an alt statement, it is also the most backward incompatible one (though some of the 'incompability' would probably result in fixing unintended behavior in existing, standardized test suites)

As a compromise between 1 and 3 which is not backward incompatible, the categories given to the alt statement could be the the covered ports/timers/components as a list (normally one) with an additional short-form which results in the semantics of 3 (i.e. active for those entities that are covered by the non-default alternatives).

alt (p, t) { [] p.receive(X) {} [] t.timeout {} }
// no default alternatives for things not happening on p or t

alt (?) { [] p.receive(X) {} [] t.timeout {} }
// same semantics as above
No tags attached.
docx CR7798.docx (192,796) 06-08-2019 14:59
http://oldforge.etsi.org/mantis/file_download.php?file_id=3819&type=bug
docx CR7798-2.docx (366,108) 07-08-2019 12:47
http://oldforge.etsi.org/mantis/file_download.php?file_id=3831&type=bug
docx CR7798-3.docx (296,378) 07-08-2019 13:34
http://oldforge.etsi.org/mantis/file_download.php?file_id=3835&type=bug
Issue History
21-09-2018 08:07Jacob Wieland - SpirentNew Issue
08-10-2018 14:49Jens GrabowskiNote Added: 0015207
08-10-2018 14:50Jens GrabowskiAssigned To => Jens Grabowski
08-10-2018 14:50Jens GrabowskiStatusnew => assigned
06-08-2019 12:28Kristóf SzabadosNote Added: 0015374
06-08-2019 12:28Kristóf SzabadosAssigned ToJens Grabowski => Jacob Wieland - Spirent
06-08-2019 14:59Jacob Wieland - SpirentFile Added: CR7798.docx
06-08-2019 14:59Jacob Wieland - SpirentNote Added: 0015376
06-08-2019 14:59Jacob Wieland - SpirentAssigned ToJacob Wieland - Spirent => Tomas Urban
06-08-2019 14:59Jacob Wieland - SpirentStatusassigned => confirmed
07-08-2019 12:47Tomas UrbanFile Added: CR7798-2.docx
07-08-2019 12:50Tomas UrbanNote Added: 0015401
07-08-2019 12:50Tomas UrbanAssigned ToTomas Urban => Jacob Wieland - Spirent
07-08-2019 13:34Jacob Wieland - SpirentFile Added: CR7798-3.docx
07-08-2019 13:34Jacob Wieland - SpirentNote Added: 0015405
07-08-2019 13:35Jacob Wieland - SpirentStatusconfirmed => resolved
07-08-2019 13:35Jacob Wieland - SpirentResolutionopen => fixed
07-08-2019 13:35Jacob Wieland - SpirentAssigned ToJacob Wieland - Spirent => Gyorgy Rethy
08-01-2020 08:54Gyorgy RethyProjectTTCN-3 Change Requests => Part 01: TTCN-3 Core Language
08-01-2020 09:25Gyorgy RethyNote Added: 0015606
08-01-2020 09:25Gyorgy RethyStatusresolved => closed
08-01-2020 09:25Gyorgy RethyFixed in Version => 4.12.1 (published 2020-05)

Notes
(0015207)
Jens Grabowski   
08-10-2018 14:49   
STF discussion: Usefull extensions. It needs to be checked how the extensions may become part of existing features (e.g., call, wait (RT extension), stopping/starting of ports).
(0015374)
Kristóf Szabados   
06-08-2019 12:28   
STF discussion: the @nodefault solution will be elaborated. The semantics should be to ignore all activated defaults for the duration of the following alt statement.
(0015376)
Jacob Wieland - Spirent   
06-08-2019 14:59   
please review
(0015401)
Tomas Urban   
07-08-2019 12:50   
The proposal is fine. I only added missing BNF rules, updated syntax of the related statements and added a restriction on when the modifier can be used. Please check.
(0015405)
Jacob Wieland - Spirent   
07-08-2019 13:34   
Renamed ReceivingCommunicationStatement to ReceivingStatement and added missing CheckStatement to it in BNF
(0015606)
Gyorgy Rethy   
08-01-2020 09:25   
Implemented in final draft V4.11.4