Problems encountered with TTCN and TTWorkbench

First I would like to mention that these problems were encountered by myself. I tried to find solutions with help from Google and Testing Technologies, the company behind TTWorkbench. Testing Technologies has done an excellent job in support so far!

Unable to find import file (module)
TTWorkbench was unable to find a module that I wanted to import when compiling. In the Editor however, the file was found using F3. Somehow TTWorkbench did not want to compile the module with the import. If you encounter this, compile the import file first.

Undeclared field ‘myField’ in type ‘record myRecord’
Check the record if the field you are using is listed.

Received no code for module ‘myModule’
When an error occurs, this message is given. Seems to dissapear when all errors are solved.

Something unexpected
What an errormessage...

Unexpected token
Usually means you forgot a ;

Imports
It propably depends on the compiler setting of how strict it is, but TTWorkbench allows for modules to import themselves. This is something you have to avoid at all costs! It will cause a lot of errors, for example with type definitions.

Message to send is null! Maybe no valid codec was specified!
This one caused a severe headache. The solution was relatively easy, the tt3plugins directory was not imported in the TTplugins. (Project properties->TTCN-3->TTplugins->TT3plugins path)

var myVar is a template variable
The variable is declared as a template. If you remove the template keyword, the problem is solved. Another option would be to adjust the function you are calling. It does not expect a template variable. For example:

template MyMessageType MyTemplate (template integer MyFormalParam) := {
field1 := MyFormalParam,
field2 := pattern "abc*xyz",
field3 := true
}

declarations after non-declaration not allowed
This message is dependent on the compiler settings. Just place all variable declarations at the beginning of a function and the message disappears.

‘*’ is a constraint | ‘?’ is a constraint
For now I have removed the error message by replacing the * and ? with omit. This may have to do with how a template is used, as I received the error when trying to use a template in a variable. The template had parameters, but I do not know if it is relevant.

not optional: ‘omit’ must not be omitted
No solution for this very frustrating message… It might have to do with optional fields.

index access to * is not allowed
This message showed itself when trying to run a testcase. The problem might be because a template has an array in it and it is not there. To solve it, I made a default template with * as content. Also I declared one item of the array, with *. I used the default template in my testcase and filled in the needed/predicted values. When I ran the test case, this error did not happen again.

not a value: expression must be a value
This error was shown when I tried to get template AAA and put it in an element that was a Union of which template AAA is a part of. To specify template AAA specifically solved the problem.

Message type is received in the wrong alt step
In the project several message types are defined. For each message type an altstep is created to catch messages that are according to the prediction and that are not. In my case type A was received in the altstep of type B. The error message was “wrong union variant selection”. To solve this, close all programs that are not needed. Restart TTWorkbench and try again. As I think this has to do with memory usage, it is recommended to add more memory to the computer you are working with.

Team City, powershell and TTWorkbench
The main problem is a bug in powershell. Which causes that the exit code is always 0 when using the -file option. See here and here. The solution can be found here.

For me the solution was to add a try-catch block around the code where errors could occur. After the TTthree.bat is called, add an if statement to check if the exit code is not equal to 0. Within this statement add the line: “throw “Compilation unsuccesfull””. Now Team City will see when an error occurs.

Advertisements
Problems encountered with TTCN and TTWorkbench

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s