Home » Eclipse Projects » Eclipse Titan » Testing SUT written in JAVA/C++
|
Re: Testing SUT written in JAVA/C++ [message #1717312 is a reply to message #1717310] |
Fri, 11 December 2015 15:45 |
|
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 #1717380 is a reply to message #1717379] |
Sat, 12 December 2015 12:49 |
|
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 |
|
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 |
Muhammad Burhan Hassan 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 #1717525 is a reply to message #1717310] |
Mon, 14 December 2015 14:59 |
Muhammad Burhan Hassan 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 |
|
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 |
|
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 #1717558 is a reply to message #1717557] |
Mon, 14 December 2015 18:13 |
|
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?
Best regards
Elemer
|
|
| | |
Re: Testing SUT written in JAVA/C++ [message #1718082 is a reply to message #1718081] |
Sat, 19 December 2015 08:22 |
|
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
|
|
| | | |
Goto Forum:
Current Time: Fri Apr 26 12:51:20 GMT 2024
Powered by FUDForum. Page generated in 0.03729 seconds
|