An Introduction to TTCN-3, Second Edition

Free download. Book file PDF easily for everyone and every device. You can download and read online An Introduction to TTCN-3, Second Edition file PDF Book only if you are registered here. And also you can download or read online all Book PDF file that related with An Introduction to TTCN-3, Second Edition book. Happy reading An Introduction to TTCN-3, Second Edition Bookeveryone. Download file Free Book PDF An Introduction to TTCN-3, Second Edition at Complete PDF Library. This Book have some digital formats such us :paperbook, ebook, kindle, epub, fb2 and another formats. Here is The CompletePDF Book Library. It's free to register here to get Book file PDF An Introduction to TTCN-3, Second Edition Pocket Guide.

Successfully reported this slideshow. We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime. Introduction to TTCN Upcoming SlideShare. Like this presentation? Why not share! Gobierno Abierto: Experiencias de I Embed Size px. Start on. Show related SlideShares at end. WordPress Shortcode.

Published in: Technology. Full Name Comment goes here. He is currently working on testing methodology, tool development and standardization. Request permission to reuse content from this site. Undetected location. NO YES. Selected type: Hardcover. Added to Your Shopping Cart. View on Wiley Online Library. This is a dummy description.

This unique book provides a fully revised and up-to-date treatment of the TTCN-3 language TTCN-3 is an internationally standardised test language with a powerful textual syntax which has established itself as a global, universal testing language. A repeat statement actually can be used only within the alternatives of either an alt statement or within the alternatives of an altstep, which we will present in the subsequent section.

Here, we use an alt statement for the same purpose; after a coin has been returned by the ticket vending machine, it is checked whether enough cash or even too much cash has been returned. In the case where the money returned is still not enough, the evaluation of the alt statement is repeated.

This means that the test case waits for another coin to be returned. Stand-alone Blocking Statements Alt statements allow to group several block operations into a single statement, but of course it is also possible to have an alt statement with only a single alternative. In this case, the behaviour is exactly as if the single alternative would have been given without a surrounding alt statement.

Table 4. We will come back to this implicit expansion of stand-alone alt statements in the discussion of default behaviour in Section 4. In that case, the alternatives can be given a name and referred to in the alt statements to avoid code duplication. In TTCN-3, altsteps provide such a mechanism.

Altsteps are similar to functions in that they can have parameters, but unlike functions, they also allow the description of guard expressions and receive and timeout operations. The altstep in Table 4. It checks whether this timer has expired and if this is the case it sets the verdict to fail. In the alt statement in Table 4. If so, then the statements in this alternative of the altstep are executed. In our case, this means that the verdict is set to fail. There could also be further statements following the altstep in the alt statement, but in this example there are none.

If the altstep contains several alternatives, then these are evaluated one after the other as in an alt statement. If any of the alternatives in the altstep could be selected, then, after returning from the altstep, execution continues with the statements following the altstep invocation, which completes execution of the alt statement.

We have already seen that altsteps can have parameters. Generally, such local variables are used to store received messages for processing them in the statements following a receive statement. In the altstep in Table 4. It is initialized whenever the altstep is called and assigned a value when a coin is received. In this case, it is used to update the total amount of returned cash. An altstep can also have a runs on clause.

An altstep is always executed within a snapshot. Therefore, the initialization of the local variables must not affect the snapshot. The restrictions on initialization of the local variables of altsteps is the same as for the Boolean guards of the alt statements see Section 4. In the case that local variables are used only to store received messages, the variables do not need to be initialized, and, therefore, there is no such problem. The changed version is shown in Table 4.

This altstep contains a repeat statement. In this case, the inner of the two nested alt statements would be repeated. A typical example is an alternative for receiving unexpected messages that have not been handled so far. Such an altstep is shown in Table 4. To avoid adding such altsteps explicitly to each and every alt statement in the abstract test suite, it is possible to use altsteps as so-called default altsteps. An activated default altstep is added implicitly by a TTCN-3 run-time system at the end of each alt statement. To use an altstep as a default, it simply has to be activated.

This is done using the activate operation. An activate statement has, as its parameter, an altstep together with its actual parameters. Execution of an activate statement returns a reference to the activated altstep; this reference can be used later on to deactivate an altstep, if wished. The reference is of type default. This altstep is now considered as a further alternative in each alt statement until the default is deactivated. The deactivation is shown at the end of the test case. The defaults are considered as alternatives after all the explicit alternatives from an alt statement have been evaluated.

This means that the alt statement from Table 4. Note that the default is added in both alt statements. In the examples from Table 4. To replace these two explicit calls with a default, we have to cope with two problems. Secondly, if several altsteps were activated as defaults, in which order will they be considered when looking for a matching alternative?

Publications

Such an altstep cannot be executed in a context where the variables to which the parameters refer to are no longer available. In this situation, a component timer can be used. This is shown in Table 4. Note that we need the runs on clause to be able to refer to the component timer.

Description

Now we can add this default altstep to the test case and take care of the timeouts implicitly. Each alt statement can now be written with only one explicit alternative. Following the convention described in Section 4. This is also the case for alt statements that contain a single invocation of an altstep. An example is shown in Table 4.

This implicit expansion of stand-alone altsteps and blocking statements implies that default altsteps will also be considered when evaluating such stand-alone statements. The resulting test case is shown in Table 4. We can now have a look at the second question. In which order will the default altsteps be considered?

One might think that the most obvious way is the order of the default activations. But actually, the defaults are considered in reverse order of their activation. Using the reverse order of activation allows activating quite general altsteps at the beginning of a test case. As long as behaviour is executed on a test component, these timers exist.

Although default altsteps can be used to get quite compact TTCN-3 codes, there is the danger that one loses track of the currently activated defaults, especially if one activates and deactivates altsteps frequently. This can lead to code that is hard to understand, which in turn might be hard to maintain. Consider this as a word of warning and think carefully about how you actually write your abstract test suite.

We have also seen in Section 3. Such functions can contain any of the statements we have seen so far. They are more general than altsteps, which have to consist of a selection among alternatives on the topmost level. The functions that we are looking at here can, for example, also start with a send statement. It is shown in Table 4. For the sake of simplicity, we assume that the amount to pay is a multiple of 10 and only 10 cent coins are used for paying.

The function has a single parameter and no return value. In the function body, we use the return statement to indicate the end of the function. It is also possible to explicitly pass the port as an inout parameter to the function and to omit the runs on clause. The function can be used in a test case as shown in Table 4. It is possible to call a value-computing function from a behavioural function and vice versa.

Even recursive calls are possible as shown in Table 4. Instead, it calls itself recursively until the requested amount of money has been paid. The port is passed as parameter; therefore, no runs on clause is necessary. In this example, we have also varied the method of payment, in so much as we have removed the limitation of only using 10 cents coins. We will also highlight the differences between functions and altsteps.

With certain restrictions, it is also possible to execute the same function on instances of other, extended, component 4. This allows, for example, to call a function from test cases that execute on a different test component type. A function can be executed on instances of component types that are an extension of the one used in its runs on clause. The extended component type must have all the component timers, ports, constants, and variables of the original type, with the exact same type and value, but it may have additional timers, ports, constants, or variables.

Exactly the same restrictions as for functions apply. There is a further, purely syntactical, restriction in TTCN-3 that applies to both functions and altsteps. This ensures that illegal function and altstep invocations, which violate the restrictions from above, can already be caught statically, and not only at run time.

As we have seen, functions and altsteps have a number of similarities. Even the call of a stand-alone altstep looks identical to a function call. In the following, we will summarize the differences between altsteps and functions. Usage in alt statements: Altsteps can be used in alt statements on the top level similar to receive and timeout statements. Functions can be used only in the statement lists of the alternatives or as part of the expressions in the Boolean guards. Usage as default: Altsteps without out or inout parameters can be used as defaults.

Functions cannot be used as defaults. A function can start with any statement.


  • Sign up to our Newsletter.
  • Soft Borders: Rethinking Sovereignty and Democracy.
  • An Introduction To Ttcn 3, Second Edition !

For functions, there are no restrictions on initializations. Return values: A function can have a return value. An altstep cannot have a return value. Therefore, an altstep is a more specialized way to describe behaviour than a function and it is mostly useful in the context of an alt statement. We focused on test cases that are executed on a single test component, that is, cases that are executed non-concurrently.

We introduced the corresponding send and receive statements. As the receive statement is blocking, we have shown how stand-alone receive statements can be extended to alt statements with several alternatives. In addition to receive statements, it is also possible to wait for the expiration of timers in an alt statement. Thereby, we can guard against a SUT that does not answer in a timely manner or does not answer at all.

An important concept when evaluating an alt statement is that all alternatives are evaluated against the same snapshot of the timer status and the message queues to avoid race conditions and inconsistencies. At each of these interfaces, the test system might have to take a different role towards the SUT. In this chapter, we will present how test cases using several test components can be written.

We will especially focus on how test components can be created and how the ports of the test components can be connected. This means that they can change while executing a test case. Compared to the use of a single test component as introduced in the previous chapter, there are several major differences. These differences are highlighted in the following. Sequential versus concurrent behaviour: The behaviour of each test component in isolation is sequential. In the non-concurrent case, the main test component MTC is the only component. Therefore, the behaviour of the whole test case is sequential.

When several test components are used, their behaviour is executed concurrently. The behaviour of all the test components contributes to the behaviour of the test case. Combination of verdicts: In the non-concurrent case, the verdict of the MTC becomes the overall verdict of the test case. In the concurrent case, the local verdicts of all the test components contribute to the overall verdict of the test case. In the concurrent case, new test components can be created and terminated throughout the test case execution.

Any test component can create and terminate other test components. In both the non-concurrent and the concurrent case, it is possible to change the mapping of component ports to the ports of the test system interface during execution. Information propagation: On a single test component, data can be passed as parameters or the component variables can be used to pass data from one part of the code to another.


  • E. M. Forster: Interviews and Recollections.
  • Download Product Flyer.
  • De-Medicalizing Misery II: Society, Politics and the Mental Health Industry.
  • Navigation menu;

In the concurrent case, data shared by several test components is mostly exchanged by explicitly passing it around in messages; there are no global variables. In this chapter, we start by presenting the extended DNS example in Section 5. In Section 5. Finally, in Section 5. In this test case, we will check whether the SUT forwards the query in the correct way if it cannot resolve a host name itself.

Three different entities are involved, as can be seen in the diagram in Figure 5. The three entities are as follows. The DNS root name server that knows which other server to ask if the query cannot be resolved locally. The remote DNS server that probably is able to provide the answer. The local name server will issue this request to a root name server. Lastly, when the local name server receives the reply from the remote name server, it will send the resolved address to the client. The sequence of message is shown in the message sequence chart MSC in Figure 5. Thereafter, we explain the various operations related to test components.

At each of these interfaces, DNS messages can be exchanged.

The port names refer to the role of the test component that should send messages via them. Note that the test system interface is not a test component on which statements are executed. It is just a set of ports. In this test case, the test system will take the role of the three entities described above. Each of these entities will run on a different test component. The MTC will only control these three parallel test components. The behaviour of a test case will be executed on the MTC as in the non-concurrent case.

The type of the test system interface is indicated by the system clause. Each of these entities has a single interface with the SUT. So far, we have talked about the component types, but we have not shown how to actually create the test components themselves. Instead, the parallel test components need to be created explicitly.

Thereafter, three instances of the component type DNSEntity are created and references to the newly created components are assigned to the three variables. Note that at this point these three test components are just created, but no behaviour is executed on them. The dotted arrows indicate that the parallel test components have been created by the MTC. Each of the boxes contains a name to identify the role of the test component and the type of the component. The create operation returns a component reference, and this component reference can be stored and then used by subsequent operations on the newly created test component.

The component reference null is a special value. It can be used to initialize variables for component references. However, using null as a component reference in a component operation will result in a run-time error. Some test components that are often referred to are the MTC, the test system interface, and the test component itself. This reference is needed when mapping ports of parallel test components to the test system interface. In the example in Table 5.

But it is also possible to use the create operation to directly initialize the variables. This is shown in Table 5. The execution of statements on the test components only occurs after an explicit calling — or starting — of a function on the test components. Before we present how to start these functions, we will have a look at the functions that are to be started. Table 5. This function is similar to the original test case, with the exception that the relevant information is passed in as parameters. The same function can be used, but it will be called with different actual parameters.

In the test case itself, after creating the test components and mapping the components, these functions are started on the parallel test components. The functions will then be executed concurrently to each other. The corresponding part of the test case is shown in Table 5. Such a function may have only in parameters; neither inout nor out parameters are allowed.

Also, the function called must have a runs on clause. The function can be called on test components that have at least the same component constants, variables, timers, and ports as the component type referred to in the runs on clause of the function. A further and important restriction is that it is only possible to start behaviour on a test component once within a given testcase.

In addition to this obvious way of terminating the execution of component behaviour, a component can also be stopped 5. The stop operation can be called without a qualifying component reference. In this case, the test component instance on which this stop statement is executed terminates its behaviour. Using the component variables of the test case shown in Table 5.

Also, it is possible to stop all parallel test components at once with the statement all component. Note that this statement does not stop the MTC. When the MTC is stopped with mtc. As a consequence, the behaviours of the parallel test components are implicitly stopped.

It can be used to wait until a component has terminated; this means it is a blocking operation. Again, using the local variables of the test case shown in Table 5. The done operation can be used in a similar manner to receive statements in alt statements and altsteps. An example of such usage can be seen in the test case in Table 5. The statement all component. In the example, there is also a timer used to guard against a component that does not terminate at all. The status of the parallel test components is included in the snapshots that are used to evaluate the guards and receiving operations of the different alternatives.

Therefore, all done statements in a single alt statement or altstep are evaluated against the same snapshot. This operation is again similar to the corresponding running operation on timers. This operation is not blocking and returns a Boolean value indicating the status of a test component.

The value true is returned when the component has already started to execute behaviour and not yet terminated. The value false is returned if the component has been created already but not yet started to execute behaviour or if the component has already terminated. An example of the running statement is shown in the code fragment in Table 5. It is checking once every second whether the component is still executing behaviour.

The running operation can also be used to check whether any or all parallel test components are executing behaviour. The relevant statements are any component. As an example, if one of the parallel test components has a verdict fail and all the other parallel test components and the MTC have the verdict pass, then the overall verdict of the test case will be fail. A test case can result in a fail verdict even when the verdict of the MTC is pass.

TTCN-3 allows both to connect test components ports to other test component ports and to map a test component port to a port of the test system interface. Only after connecting or mapping a port it is possible to send or receive messages via this port. Note that two different terms are used in TTCN mappings and connections. As an example, the map statements in Table 5.

Each of these components has a port named pt. The solid arrows indicate the established mappings. To enable the mappings to be changed at runtime, it must be possible to undo a mapping, which can be done with the operation unmap. The parameters are exactly the same as for the map operation.

okanoqoriq.tk

An Introduction to TTCN-3, 2nd Edition [Book]

In the example shown in Table 5. Although the mappings can be changed throughout test case execution, the mappings themselves must conform to certain rules. Both conditions imply that no message can get lost. At least, it cannot get lost without this situation being recognized: If this should occur at run time, then the TTCN-3 run-time system will signal a run-time error and set the local verdict of the relevant test component to error.

The operation to connect two ports is connect. The parameters are similar to the map operation. However, whereas in the map operation one of the component references must be system, in a connect statement both references are referring to test components and not to the test system interface. The connection between ports can be changed throughout the execution of a test case; a connection is removed with the disconnect operation. Similar to the mapping of ports, there is a restriction on connections to ensure that each message sent can actually be delivered.

If two ports are connected, for any message that can be sent via one of the ports, it must be possible to receive messages of this type at the other port and vice versa.

In this case, it is quite easy to determine the receiving port when a message is sent. This is the port to which the sending port is mapped or connected. This means that for the sending component the recipient of a message is uniquely determined by the used port. In the example in Section 5.

Another scenario where parallel test components are useful is when several clients simultaneously request host name resolution from a DNS server. Extending this example further, each of the parallel test components measures how much time the server needs to answer its request. This time is sent from each of the parallel test components to the MTC. Figure 5. This is called a many-to-one mapping. Similarly, it is possible to connect several ports with one port. It does not matter from which of the parallel test components the message was sent; the message would be received independent of its sender.

The actual sender of a message can be retrieved and stored similar to the actual message received. To do so, a receive statement is extended by a from clause. Such a selective receive statement is shown in Table 5. To send a message to one of several components connected to the same port, a send statement can be extended with a to clause. This clause indicates the destination test component the message should be sent to. Considering the example shown in Table 5. For example, a port cannot be connected to two ports on the same test component. In TTCN-3, the message transfer via ports can be stopped and restarted again.

Messages via a stopped port will not be delivered and messages enqueued at a stopped port do not show up in the snapshots when evaluating alt statements. The operations to stop and restart message transfer are stop and start. Additionally, it is possible to remove all enqueued messages at a port using the operation clear. Similarly, several entities in the SUT can exchange messages with the test system through a single port. References to such entities in the SUT are values of the type address and can be used in a similar way to component references in communication operations.

This means that such addresses can be used in to and from clauses of the communication statements and can be stored in variables of type address. After the local declarations in the test case, the parallel test components are created; thereafter, the ports of the test components are mapped or connected.

Next, the behaviours on the parallel test components are started. Note that the behaviours of those clients that have a server role are started before the behaviour of the component that has a client role. The idea is to have server components running before the clients start to execute. In other test cases, it might be necessary to have further synchronization before one or more test components with a client role start executing behaviour.

We will have a closer look at synchronization in Section After starting the behaviours on the parallel test components, the test case blocks until all parallel test components have terminated or until 30 seconds have passed. At the end, the mappings of the ports are removed explicitly and the test case terminates. This is the appropriate test approach in many applications and indeed has been the only communication paradigm that was available in TTCN-2 [8]. Many of these cannot be adequately modelled using message-based communication but rather require some form of procedure-based communication to be tested in a natural manner.

Thus, a procedurebased communication paradigm was added to TTCN In this chapter, we will study how systems that rely on procedure-based communication can be tested adequately with TTCN Only the semantics of the protocol create the distinction between clients and servers. In contrast, procedure-based communication makes a clear distinction between these roles: for each communication act, there exists a distinct client that invokes calls a remote procedure, and a distinct server that processes this invocation and eventually returns a reply or, in erroneous conditions, raises an exception.

Message-based communication in TTCN-3 is asynchronous in nature, and the sender of a message will proceed with its behaviour before its message has been answered or even has been received by its communication partner. In contrast, procedure-based communication is, in most cases, synchronous. The caller of a remote procedure will block until a reply has been returned or an exception has been raised. There are also cases where the caller does not wait for the result of the invocation but rather attempts to collect the reply at a later point in time.

Both forms of procedure-based communication are well supported by TTCN When logging into the directory service, clients receive a reference to the directory, which they can use to look up keys. Certain privileged clients may also update the directory and insert new or update existing associations. Table 6. IDL [20] is a standardized language to specify interfaces for distributed, object-oriented systems and is used to specify CORBA-based systems. Once a handle to the directory has been acquired from the directory manager, this reference may be used to access the directory.

Read access is performed via the lookup method, which raises a NotFound exception if the queried key cannot be found. Write access is performed via the update method. If the value for an existing key is updated, the previous value is returned via the inout value parameter val of the update method, otherwise the empty string "" is returned via this parameter.

An attempt to update the directory without write capabilities will raise a NotAllowed exception. A session is terminated by a call to logout, which invalidates the reference, that is, further lookup or update invocation via this reference will raise the SessionExpired exception. It is of course not accidental that a signature looks very similar to a function prototype — it represents a remotely invokable procedure; indeed, we will use these terms interchangeably. What has been added to normal functions is the possibility to specify exceptions, which are commonly used to indicate error conditions in many procedure-based distributed systems.

We have already mentioned that the signatures specify the types of the exceptions, so to make the signatures from Table 6. The fact that the Directory port type is used for procedure-based communication is indicated by the procedure keyword. The calling direction is indicated by the in, out, and inout keywords. Signatures that are declared out or inout may be called via the port. In this case the test system plays the role of a client.

For signatures that are declared in or inout, calls may be received. In this case the test system plays the role of a server. The restrictions placed on the possible connect and map operations for procedurebased ports are the same as those for message-based communication. It is possible to deviate from this communication scheme, though, should it be necessary for testing purposes. One possibility is to declare non-blocking signatures; other possibilities will be described when we discuss the call invocation operations.

A signature may be declared as non-blocking if it does not specify a return type and has no out or inout parameters; in parameters are permitted. The invocation of such a remote procedure does not allow passing information back from the callee to the caller other than that the invocation has been received and possibly processed.

One example for such a signature could be an unacknowledged version of the logout signature from the example above, which enables the client to log off from the directory service without waiting for an acknowledgement. A non-blocking signature is declared using the noblock keyword: signature unackedLogout noblock; There are certain restrictions on non-blocking signatures when they are used in the communication operations, which we will discuss in Section 6.

The client sends a request to the directory, which is then received and processed by the server. Should the requested key be found in the directory, the server replies to the call and the client receives this reply. Should the key not be found, the server raises an exception, which needs to be caught by the client. For the moment, we will disregard how the client obtained a handle to the directory or how the directory is addressed; we will study these issues later.

We can also see that each of these modes involves a sending and a receiving party: the call is sent by the client and received by the server. The reply or exception is sent in the inverse direction from the server to the client. Consequently, there exist six communication operations in TTCN-3 that represent the possible combination of communication mode and sending or receiving side: call and getcall, reply and getreply, raise and catch.

Its underlying type has to be of procedure or mixed kind, and must list the called signature among its out signatures. These will be covered in Chapter From the minimal example in Table 6. Instead, any call statement for a signature that has not been declared non-blocking must have a body that handles the different possible results of the call. Let us study this call operation and its body in some more detail.

It is a typical example of a synchronous, blocking call operation without timeout. Asynchronous procedure invocation and timed procedure invocations will be treated in the following 6. In this simplest form of the call operation, the call is followed by a body — structured like an alt statement body — that enumerates different possible outcomes of the call. The body of the call statement is restricted to only deal with the possible outcomes of the call.

It is not permitted to use altsteps or an else branch in the body. In addition, any operation that guards an alternative in the call statement body must refer to the same port and the same signature that has been used in the call operation. We will now study the available guard operations that are available inside the call statement body in more detail. We expect to get a reply to our update invocation with the second parameter set to the empty string because no password has been set before this call: [] pt.

This must be the same port as the initial call was issued on. In a similar way, the template used to specify the expect reply must have the same signature as the initial call. For the second, inout parameter, we require that the empty string is set upon the return of the invocation. Any other value is covered by the second alternative and leads to a fail verdict. The update operation does not have a return value.

Account Options

Success is indicated by the fact that the procedure returns without raising an exception, and the relevant information is passed back via the second parameter. Of course, it is also possible to specify constraints on the return value, if the called procedure has a declared return type. It is not mandatory to specify constraints for a return value, even when the procedure has a return type, so the second alternative could be written more succinctly as: "[] pt.

For example, to access the actual value of the val parameter in the update procedure, one could use value redirection as shown in Table 6. After the keyword, there is then a comma-separated list with one entry per parameter of the signature. Each out or inout parameter may be redirected to a variable of the corresponding type.

This alternate notation is shown in Table 6. Further redirections could be put into the same list, separated by commas.