|
|
|
|
|
Re: Dynamic test case error: Performing a valueof or send operation on a non-specific template [message #1723382 is a reply to message #1723359] |
Mon, 15 February 2016 10:11 |
|
Hi Murli,
The default value (or 'omit' in case compiler option d is used) is only set automatically for values defined in ASN.1 code. Values and templates in TTCN-3 code need the attribute 'with { optional "implicit omit" }' to automatically set default values to omit.
Example:
template TestType testtype :=
{
n1 := 10
}
with { optional "implicit omit" }
For details about -d, please see ch 6.1.1 of the reference guide:
-d
This switch changes the way fields of ASN.1 SEQUENCE /SET types with DEFAULT values are handled. Without -d, the runtime handles the encoding and decoding of default values in a way that is consistent with DER and CER. With -d in effect, the ETS is responsible for the handling of fields with default values. This makes it possible to send encodings which are valid BER but not valid DER/CER and to verify that the SUT has performed the encoding correctly (note that without -d, the cases marked * and ** below cannot be distinguished in TTCN code).
Sending Without d With d
Explicit value Send value Send value
Default value Do not send (omit) Send default value
omit N/A Do not send (omit)
Receiving Without d With d
Receive explicit value TTCN sees value TTCN sees value
Receive default value TTCN sees default value* TTCN sees default value
Omitted TTCN sees default value** TTCN sees 'omit'
Warning! Existing tests may behave differently when compiled with -d. Every behavior without -d can be duplicated when compiled with -d.
Best regards
Elemer
|
|
|
|
|
|
|
|
|
Re: Dynamic test case error: Performing a valueof or send operation on a non-specific template [message #1724201 is a reply to message #1724163] |
Mon, 22 February 2016 09:47 |
|
Hi Murli,
although this appears to be a solution, it really is not.
If we would disable DTE for this particular issue, than the program error would propagate to other parts of the code and would stop execution a couple of lines later. A corrupt variable/template would poison any other
variable/template it transfers value into.
DTE is meant to stop such propagation of programming errors.
I would assume you have your templates in a separate file , so it should not be very complicated to check them with the "isbound" logic as above,
or similarly with :
if (not(isvalue(sometemplate ))) { log (sometemplate)}
You can also protect your code in the file which is executed with these if statements, or with try /catch as suggested below.
Best regards
Elemer
|
|
|
|
|
|
|
|
Re: Dynamic test case error: Performing a valueof or send operation on a non-specific template [message #1724508 is a reply to message #1724467] |
Wed, 24 February 2016 09:44 |
|
Hi Murli,
the way it works is the following:
one has to specify the default value in the TTCN-3 template as well:
Types DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
MyData ::= SEQUENCE {
n1 INTEGER DEFAULT 7,
n2 INTEGER OPTIONAL
}
END
module Example {
/* import types from ASN.1 */
import from Types language "ASN.1:1997" all;
type component Test {}
type component SUT {}
template MyData setMyData := {
} with {optional "implicit omit"}
template MyData setMyData1 := {n1:= 7
} with {optional "implicit omit"}
// test case definition
group TestCases {
testcase test_msg_exchange() runs on Test system SUT {
log("****************************************");
log("ASN Seqence:");
log(valueof(setMyData));
}
testcase test_msg_exchange1() runs on Test system SUT {
log("****************************************");
log("ASN Seqence:");
log(valueof(setMyData1));
}
}
control {
execute(test_msg_exchange())
execute(test_msg_exchange1())
}
} with { encode "BER:1997" }
with the result:
10:38:03.096654 TTCN-3 Main Test Component started on esekilxxen1842. Version: CRL 113 200/5 R4C.
10:38:03.096791 TTCN Logger v2.2 options: TimeStampFormat:=Time; LogEntityName:=No; LogEventTypes:=No; SourceInfoFormat:=None; *.FileMask:=LOG_ALL; *.ConsoleMask:=LOG_ALL; LogFileSize:=0; LogFileNumber:=1; DiskFullAction:=Error
10:38:03.096879 Connected to MC.
10:38:03.103655 Executing control part of module Example.
10:38:03.103699 Execution of control part in module Example started.
10:38:03.103754 Test case test_msg_exchange started.
10:38:03.103793 Initializing variables, timers and ports of component type Example.Test inside testcase test_msg_exchange.
10:38:03.103842 Component type Example.Test was initialized.
10:38:03.103863 ****************************************
10:38:03.103881 ASN Seqence:
10:38:03.103899 { n1 := omit, n2 := omit }
10:38:03.103966 Terminating component type Example.Test.
10:38:03.103992 Component type Example.Test was shut down inside testcase test_msg_exchange.
10:38:03.104019 Waiting for PTCs to finish.
10:38:03.104118 Setting final verdict of the test case.
10:38:03.104163 Local verdict of MTC: none
10:38:03.104207 No PTCs were created.
10:38:03.104230 Test case test_msg_exchange finished. Verdict: none
10:38:03.104264 Test case test_msg_exchange1 started.
10:38:03.104286 Initializing variables, timers and ports of component type Example.Test inside testcase test_msg_exchange1.
10:38:03.104312 Component type Example.Test was initialized.
10:38:03.104333 ****************************************
10:38:03.104351 ASN Seqence:
10:38:03.104376 { n1 := 7, n2 := omit }
10:38:03.104415 Terminating component type Example.Test.
10:38:03.104437 Component type Example.Test was shut down inside testcase test_msg_exchange1.
10:38:03.104466 Waiting for PTCs to finish.
10:38:03.104543 Setting final verdict of the test case.
10:38:03.104572 Local verdict of MTC: none
10:38:03.104593 No PTCs were created.
10:38:03.104615 Test case test_msg_exchange1 finished. Verdict: none
10:38:03.104641 Execution of control part in module Example finished.
10:38:03.111636 Verdict statistics: 2 none (100.00 %), 0 pass (0.00 %), 0 inconc (0.00 %), 0 fail (0.00 %), 0 error (0.00 %).
10:38:03.111712 Test execution summary: 2 test cases were executed. Overall verdict: none
10:38:03.111735 Exit was requested from MC. Terminating MTC.
I admit it may be a bit counter intuitive; please also be aware that behaviour also depends on the -d switch and the chosen encoding BR vs. CER/DER (see description of the -d switch in the refguide)
I hope this helps
Best regards
Elemer
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04399 seconds