Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Testing SUT written in JAVA/C++
Testing SUT written in JAVA/C++ [message #1717310] Fri, 11 December 2015 15:25 Go to next message
Muhammad Burhan Hassan is currently offline Muhammad Burhan HassanFriend
Messages: 28
Registered: November 2015
Junior Member
Hi,

I am trying to find a way to test SUT written in JAVA/C++.

I have already accomplished it by using UDP Test Port available from
https://projects.eclipse.org/projects/tools.titan/developer.

Now i am looking to bypass connection over internet, between Test System and SUT, both running on the same system.

Which test port is suitable for this type of interfacing, any examples will be helpful Smile .

Regards,
Burhan
Re: Testing SUT written in JAVA/C++ [message #1717312 is a reply to message #1717310] Fri, 11 December 2015 15:45 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Muhammad,

in case of a real SUT the answer depends on what kind of protocol interfaces the SUT has:
for instance , a web server will have an HTTP/HTTPS interface , so you will have to use the HTTP test port (or the HTTP protocol module and the TCP test port);
to run LDAP interrogations one would used the LDAP test port;
for Jabber chat/presence the XMPP protocol module and the TCP test port; and so on.

So the answer depends on what kind of service one wants to test.

If you just want to play with the idea of connecting two machines over the network, then split your code in two, and run the UDP server on one machine, the UDP client on the other machine and send some payload across the network.

In this forum I have posted several examples that can be run on the same machine as well as across a network connection.
It's great fun to discover things for yourself and play with them so I would encourage you to do so.

Best regards

Elemer

Re: Testing SUT written in JAVA/C++ [message #1717379 is a reply to message #1717312] Sat, 12 December 2015 12:36 Go to previous messageGo to next message
Muhammad Burhan Hassan is currently offline Muhammad Burhan HassanFriend
Messages: 28
Registered: November 2015
Junior Member
Hi Elmer,
Ok i got it. I have developed a small example of using UDP Test Port, as you guided in this thread : https://www.eclipse.org/forums/index.php/m/1714678/#msg_1714678
I had successful communication with my Server, but now i am having this warning and error:
 Warning: The maximum number of open file descriptors (256) is greater than FD_SETSIZE (64). Ensure that Test Ports using Install_Handler do not try to wait for events of file descriptors with values greater than FD_SETSIZE (64). (Current caller of Install_Handler is "DevUDPPort")
 ./UdpMod: Segmentation fault occurred
Error: Unexpected end of MTC connection from PMX-NB07.local [192......].
MC@PMX-NB07: The control connection to MTC is lost. Destroying all PTC connections.


What could be the reason for this error?

Regards,
Burhan
Re: Testing SUT written in JAVA/C++ [message #1717380 is a reply to message #1717379] Sat, 12 December 2015 12:49 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Muhammad,

your UDP test port is either not configured , or not configured properly and causes a segmentation fault during initialization;
if you are using the port in basic mode, please make sure all config parameters (mode, IpAdress, port nr. etc, see documentation) are present in the config file.
If you want to use the port in advanced mode, then these parameters are sent to the port from TTCN via port messages.(This permits changing port configuration on the fly).
Please also make sure that when you start your executable the config file is read.

If you upload the code and config file I can take a look.

Best regards
Elemer



Re: Testing SUT written in JAVA/C++ [message #1717381 is a reply to message #1717380] Sat, 12 December 2015 13:22 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Muhammad,

pls don't forget that in case you want to configure a server and a client, the corresponding UDP ports have to have different configuration:

the server should listen on iocalhost, localport nr.
and the client has to connect to remotehost, remoteport nr.

Best regards
Elemer
Re: Testing SUT written in JAVA/C++ [message #1717429 is a reply to message #1717310] Sun, 13 December 2015 15:19 Go to previous messageGo to next message
Muhammad Burhan Hassan is currently offline Muhammad Burhan HassanFriend
Messages: 28
Registered: November 2015
Junior Member
Hi Elmer,
Ok now i can execute it properly on cli (after i added .cfg file in ttcn3_start command)

I am trying to run it on Eclipse, Added all ttcn,.hh,.cc files in TTCN-3 Project.. But getting this error:
MTC@PMX-NB07: Execution of control part in module UdpMod started.
MTC@PMX-NB07: Test case TestStateMachine started.
MTC@PMX-NB07: Warning: The maximum number of open file descriptors (256) is greater than FD_SETSIZE (64). Ensure that Test Ports using Install_Handler do not try to wait for events of file descriptors with values greater than FD_SETSIZE (64). (Current caller of Install_Handler is "DevUDPPort")
Error: Unexpected end of MTC connection from PMX-NB07.local [192....].
MC@PMX-NB07: The control connection to MTC is lost. Destroying all PTC connections.
MC@PMX-NB07: MTC terminated.


Then i tried to add same Configuration File which i was using in cli execution, as shown in attached image, but i think it does not consider this cfg file, as i can see in Console Window
Using configuration file: temporal_4560377485830658454_XXXXX.cfg
.

Can you see where i am going wrong with its execution on Eclipse-Titan..

Regards,
Burhan
  • Attachment: Capture.PNG
    (Size: 53.92KB, Downloaded 212 times)
Re: Testing SUT written in JAVA/C++ [message #1717431 is a reply to message #1717429] Sun, 13 December 2015 15:46 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Muhammad,

could you please check this video:
https://www.youtube.com/watch?v=hso34ReEiP8

It was not made by us, but by a user of open source Titan, and it explains thoroughly how to setup and configure the Eclipse plug-ins;
maybe it will help you.

Best regards
Elemer
Re: Testing SUT written in JAVA/C++ [message #1717525 is a reply to message #1717310] Mon, 14 December 2015 14:59 Go to previous messageGo to next message
Muhammad Burhan Hassan is currently offline Muhammad Burhan HassanFriend
Messages: 28
Registered: November 2015
Junior Member
Hi Elmer,

The video was interesting, and i was following the same steps in my example as well. I can execute the HelloWorld example project , but still my own project do not execute.I think the problem is, it do not read my .cfg file (although i have given the path of it)..
I have attached the .cfg file and my .ttcn module, please have a look (The project executes correctly from cli ...)

One more concept, which i will to clear, is about Codec. I am using UDP test port, which transmit data in Octet form. If i want to send "integer" to SUT, will i have to write my own function inn ttcn module to convert integer to Octet String (by using int2oct)? The same step will be implemented for every data type which i want to transmit via UDPTestPort... right?
So i have implemented these function, but could not find an appropriate way to convert "negative integer" into octet (I tried with negInt->charstring->octetString conversion, but it is not giving me always 4 byte oct)... Can you suggest any thing..

Regards,
Burhan

[Updated on: Mon, 14 December 2015 15:01]

Report message to a moderator

Re: Testing SUT written in JAVA/C++ [message #1717531 is a reply to message #1717525] Mon, 14 December 2015 15:26 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Muhammad,

every kind information is transmitted as octetstrings across the network ; to achieve this , we have to have rules about how to convert all kinds of information into octetstring (binary data).
These rules are called encoding rules , and the symmetrical rules to restore the information from binary data are called decoding rules.

In Titan this can be achieved using the built-in RAW codec ( see the four part series The binary RAW encoder of Titan in this forum).

According to the reference guide ch 4.23/ par 4.23.5 an integer can have the following attributes:
Attributes allowed:	

BITORDER			
BITORDERINFIELD	
BYTEORDER			
COMP			
FIELDLENGTH



where the COMP attribute
is described as:

This attribute specifies the type of encoding of negative integer numbers as follows:
nosign: negative numbers are not allowed;
2scompl: 2's complement encoding;
signbit: sign bit and the absolute value is coded.


So you will have to write a simple RAW encoder to encode your integer , and on the other end, a RAW decode based on the exactly same rules to decode your integer.


I hope this will help


The Eclipse part will be answered by a coworker of mine.



Best regards


Elemer











Re: Testing SUT written in JAVA/C++ [message #1717532 is a reply to message #1717525] Mon, 14 December 2015 15:27 Go to previous messageGo to next message
Jeno Attila Balasko is currently offline Jeno Attila BalaskoFriend
Messages: 80
Registered: September 2013
Location: Budapest, Hungary
Member

Hi Burhan,
I've just answered a similar problem in this link: https://www.eclipse.org/forums/index.php/t/1072811/
It's about to avoid usage of the temp config file. If you are successful to use your config file instead of the temp cfg file with default values you should see something similar in the TITAN runtime console ( just my example is about sctp instead of udp) :
sh -c sleep 1; $TTCN3_DIR/bin/mctr_cli '/home/ethbaat/ttcn_munka/SctpEcho/SctpEcho.cfg'
sh -c cd /home/ethbaat/workspaces/wp_GobbiHilda/SctpEcho/bin; ./SctpEcho ethbaat-VirtualBox 45055

Runtime console is one console option in the Console View. The port specific questions will be answered by Elemer.
BR
Jeno
Re: Testing SUT written in JAVA/C++ [message #1717557 is a reply to message #1717532] Mon, 14 December 2015 17:47 Go to previous messageGo to next message
Muhammad Burhan Hassan is currently offline Muhammad Burhan HassanFriend
Messages: 28
Registered: November 2015
Junior Member
Hi Elmer,

I have tried the following code:

type integer SIGNED_INT
		with {
		  variant "COMP(signbit)";
		  variant "FIELDLENGTH(8)"
		} 
		
	external function enc_integer( in integer intInput ) return octetstring
		with { extension "prototype(convert) encode(RAW)" }
		
  testcase TestRAWInt() runs on myUDPDevice
  {	
	const SIGNED_INT temp_i := -1;	
       //if i make temp_i:=1, it works...
	setverdict(pass,enc_integer(temp_i));
  }


I have written "with { encode "RAW" } " at the end of module..
When i execute it, produces error:
"Dynamic test case error: While RAW-encoding type 'INTEGER': Unsigned encoding of a negative number: INTEGER (No such file or directory)"

I thought i am missing any protocol module for enc/dec, i tried to find one but don't know which one to use among those available in following link:
https://github.com/search?p=2&q=titan+protocol+modules&type=Repositories&utf8=%E2%9C%93

Please see where i am going wrong..
Regards,
Burhan
Re: Testing SUT written in JAVA/C++ [message #1717558 is a reply to message #1717557] Mon, 14 December 2015 18:13 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Muhammad,

try the following:

module MyModule {

type integer SIGNED_INT
		with {
		  variant "COMP(signbit)";
		  variant "FIELDLENGTH(8)"
		} 

 type component myUDPDevice
    {
	
    }
 


		
	external function enc_integer( in SIGNED_INT intInput ) return octetstring
		with { extension "prototype(convert) encode(RAW)" }
		
  testcase TestRAWInt() runs on myUDPDevice
  {	
 
	const SIGNED_INT temp_i := -1;	
       //if i make temp_i:=1, it works...
     log(enc_integer(temp_i))  
	setverdict(pass,enc_integer(temp_i));
	
	
	
  }

control{

execute (TestRAWInt())
}
  
  
}
with { encode "RAW" }




You are going in the right direction; the problem with your code was
that
external function enc_integer( in SIGNED_INT intInput ) return octetstring

takes SIGNED_INT and not integer as parameter;

TTCN-3 is very strongly typed and even if two types are defined in the same manner,
they are considered different; so SIGNED_INT and integer are considered two totally different types ;and there are no encoding rules defined for integer so defaults will apply;and default for COMP is nosign.


Tricky, isn't it? Smile

Best regards
Elemer
Re: Testing SUT written in JAVA/C++ [message #1717676 is a reply to message #1717558] Tue, 15 December 2015 18:00 Go to previous messageGo to next message
Muhammad Burhan Hassan is currently offline Muhammad Burhan HassanFriend
Messages: 28
Registered: November 2015
Junior Member
Thanks for the explanation Elemer Smile It was quite a help and i got it working.

Regards,
Burhan
Re: Testing SUT written in JAVA/C++ [message #1718081 is a reply to message #1717532] Sat, 19 December 2015 07:46 Go to previous messageGo to next message
Muhammad Burhan Hassan is currently offline Muhammad Burhan HassanFriend
Messages: 28
Registered: November 2015
Junior Member
Hi Blasko,
Previously i was using Titan Designer and Executor 5.3 and i was not able to use my configuration file for execution.
I followed the thread https://www.eclipse.org/forums/index.php/t/1072811/ and tried to re install the eclipse with its plugins, as i was having error while updating.
I used the following link to download required plugins,
https://projects.eclipse.org/projects/tools.titan/downloads


    1. I downloaded jung 2.0.1
    2. then downloaded common collection 4.01
    3. Eclipse Mars
    4. TITAN 5.4.0

then i placed the respective ".jar" files from "jung" and "common collections" into the plugin folder of Eclipse.
Opened the eclipse and started new software installation by giving the path to downloaded Titan Designer and Executor folder.

After that, i get the error as shown in attached images.

Can you please tell what could be the problem.

Regards,
Burhan




  • Attachment: Capture.PNG
    (Size: 32.14KB, Downloaded 257 times)
  • Attachment: Error.PNG
    (Size: 30.20KB, Downloaded 249 times)
Re: Testing SUT written in JAVA/C++ [message #1718082 is a reply to message #1718081] Sat, 19 December 2015 08:22 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Muhammad,


the only difference between what Jeno recommended

Hi,
I repeated the install from scratch on Windows 7. 
1. I downloaded Eclipse Luna 4.4.0 (Eclipse Standard/SDK, Version: Luna Release (4.4.0), Build id: 20140612-0600 ) and unzipped it
2. I downloaded CommonCollections from https://www.eclipse.org/downloads/download.php?file=/titan/commons.collections.zip and copied the unzipped folder to the plugin folder. (The latest 4.1 version from apache.org does not fit !)
3. I downloaded Jung from https://www.eclipse.org/downloads/download.php?file=/titan/edu.uci.ics.jung.zip and copied the unzipped folder to the plugin folder (Other versions from other sources are risky!)
4. I downloaded the Titan IDE 5.4 plugins from https://www.eclipse.org/downloads/download.php?file=/titan/TITAN_on_Eclipse_5.4.0.CRL_113_200_5_R4A_20151113-1513.zip, unzipped it 
5. I opened eclipse and installed Titan IDE from the local update site (the unzipped folder is the site). Every conponent has been installed wihout any problem.


BR
Jeno


and what you did is that you used Eclipse Mars;


Could you please try Eclipse Luna and we'll investigate if there's any problem with Mars.
Also it's not apparent from what you are saying whether you use Windows or Linux.


BR

Elemer


Re: Testing SUT written in JAVA/C++ [message #1718083 is a reply to message #1718082] Sat, 19 December 2015 09:09 Go to previous messageGo to next message
Muhammad Burhan Hassan is currently offline Muhammad Burhan HassanFriend
Messages: 28
Registered: November 2015
Junior Member
Hi Elmer,
I am using Windows 10.
I tried with Eclipse Luna, but the same problem remains.
The image of error which is displayed with Luna is attached.

Regards,
Burhan
  • Attachment: Capture.PNG
    (Size: 33.98KB, Downloaded 233 times)
Re: Testing SUT written in JAVA/C++ [message #1718085 is a reply to message #1718083] Sat, 19 December 2015 09:27 Go to previous messageGo to next message
Muhammad Burhan Hassan is currently offline Muhammad Burhan HassanFriend
Messages: 28
Registered: November 2015
Junior Member
Hi Elmer,
Here is some progress, but still something missing.
Cannot complete the install because one or more required items could not be found.
  Software being installed: Titanium_Feature 5.4.0.CRL_113_200_5_R4A_20151113-1513 (Titanium.feature.group 5.4.0.CRL_113_200_5_R4A_20151113-1513)
  Missing requirement: Common TITAN on Eclipse Plug-in 5.4.0.CRL_113_200_5_R4A_20151113-1513 (org.eclipse.titan.common 5.4.0.CRL_113_200_5_R4A_20151113-1513) requires 'bundle org.antlr.runtime 4.3.0' but it could not be found
  Cannot satisfy dependency:
    From: Titanium_Feature 5.4.0.CRL_113_200_5_R4A_20151113-1513 (Titanium.feature.group 5.4.0.CRL_113_200_5_R4A_20151113-1513)
    To: org.eclipse.titan.common 4.1.0


I tried to install antlr and got version 4.1 as shown in image. But still same error.
From where can i get this antlr runtime and where should i place it?

Regards,
Burhan
  • Attachment: Capture.PNG
    (Size: 20.51KB, Downloaded 256 times)

[Updated on: Sat, 19 December 2015 09:49]

Report message to a moderator

Re: Testing SUT written in JAVA/C++ [message #1718087 is a reply to message #1718085] Sat, 19 December 2015 09:58 Go to previous message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Burhan,

Eclipse produces bundles of 3rd party SW see https://www.eclipse.org/orbit/
org.antlr.runtime 4.3.0 is present in the latest bundles.

Please download the one that matches your Eclipse version from:
http://download.eclipse.org/tools/orbit/downloads/

Installation instructions are also given there.


Best regards

Elemer



Previous Topic:Default as Omit not working in TTCN 3 test cases
Next Topic:Debugging TTCN
Goto Forum:
  


Current Time: Fri Apr 26 12:51:20 GMT 2024

Powered by FUDForum. Page generated in 0.03729 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top