07.01.2013 Views

Lecture Notes in Computer Science 3472

Lecture Notes in Computer Science 3472

Lecture Notes in Computer Science 3472

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

16 TTCN-3 479<br />

To apply a send<strong>in</strong>g operation (stimuli) there shall be specified a port used to<br />

send the data, the value to be transmitted, and optionally an address to identify<br />

a particular connection if the port is connected to many ports. Additionally, at<br />

procedure based communication the response and error operation are needed;<br />

they are specified by us<strong>in</strong>g the getreply and catch operations.<br />

These operations are<br />

• send: send a message to SUT,<br />

• call: to <strong>in</strong>voke a remote procedure,<br />

• reply: to reply a value when an own procedure is called,<br />

• raise: to report an exception when an own procedure is called an someth<strong>in</strong>g<br />

is wrong <strong>in</strong> the procedure call.<br />

The message based communication is asynchronous communication. The<br />

send<strong>in</strong>g operations are non-block<strong>in</strong>g; after send<strong>in</strong>g the data, the system does<br />

not wait for response. The receive operations block the execution until a match<strong>in</strong>g<br />

value is received.<br />

A receiv<strong>in</strong>g operation specifies a port at which the operation takes place,<br />

def<strong>in</strong>es a match<strong>in</strong>g part for selection of valid receiv<strong>in</strong>g values and optionally<br />

specifies an address to identify the connection (if the port is connected to many<br />

ports).<br />

These operations are<br />

• receive: receive a message from SUT<br />

• getreply: specifies that a method is <strong>in</strong>voked<br />

• trigger: specifies a message that shall receive <strong>in</strong> order to go to the next<br />

statements<br />

• catch: to collect an exception reported at remote procedure <strong>in</strong>vocation.<br />

Timer Operations The behavior specification may use timers. A timer is used<br />

as a type; therefore <strong>in</strong>stances of it can be declared. The operations with timers<br />

are start, stop, read (to read the elapsed time), runn<strong>in</strong>g (to check if the timer<br />

is runn<strong>in</strong>g) and timeout (to check if timeout event occurred). At the declaration<br />

of a timer, a value can be assigned; the value is of type float. The start command<br />

may be used with parameter (the duration for which the timer will be runn<strong>in</strong>g)<br />

or without parameter (when the default value specified at declaration is used).<br />

In our example, we def<strong>in</strong>e a timer on PTCType component and use it <strong>in</strong> the<br />

SeparateSearchFunctional behavior. In general, timers are used to measure<br />

the time between send<strong>in</strong>g a stimuli and the SUT’s response. If the SUT’s answer<br />

does not come <strong>in</strong> a predef<strong>in</strong>ed period of time, usually the verdict is set to fail.<br />

Verdict Handl<strong>in</strong>g The verdicts can be set and retrieved by us<strong>in</strong>g the setverdict<br />

and getverdict operations respectively. These operations are allowed <strong>in</strong> test<br />

cases, functions and altsteps. For verdict declaration and <strong>in</strong>stantiation, TTCN-3<br />

provides the verdicttype type. This type is an enumeration of five values: pass,<br />

fail, <strong>in</strong>conc, none and error.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!