Robot For M2M User Guide

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 16

Robot Framework for M2M Testing -

User Guide
Important Features

 Robot framework is a generic test automation


framework which utilizes keyword driven testing
approach
 Its testing capabilities can be extended by creating
custom libraries where the keywords are
implemented
 Provides easy to read logs and reports
 Provides tagging to categorize and execute test
cases in a particular order
 Has in-built support for variables to test in different
environments
 Has a modular architecture which supports
reusability
Radisys Corporation Confidential 2
ROBOT Test framework for M2M -
High level Architecture for Demo

PY to C
Test case
method calls C coap
ROBOT C HTTP UDP SUT
containing PY Test and XML Socket (GW/NS)
keywords Invoke PY Library Send / Receive
(RIDE) lib
Test library messages
to / from SUT

• Robot IDE to edit and execute test cases and view logs and reports. A Test case is a collection of keywords.
RIDE

• Python library containing implementation for keywords. A set of keywords put together shall form a test case. Once we build a
repository of standard key words to send messages and to process successful / error response / timeouts we can construct test cases to
ROBOT PY suite various scenarios.
Test Lib

• To start off test framework shall use the existing C based coap and XML libraries, this shall be replaced with Python Libraries going
forward.
C coap and
XML lib

• Bound by C coap library for now, shall be replaced with a python module in the first version of the tool.
UDP Socket

Radisys Corporation Confidential 3


Keywords in Test Library – OOPs
paradigm
 Build <Resource Name> - instantiates an object of type
<Resource Name>
 Set Attribute <name, value> – sets the value of resource’s
attribute
 Set Primitive <name, value>– sets the value of primitive
attribute for the particular message
 Set Endpoint <name, value>– sets the value of peer ip address,
peer port and host scl name
 Send Msg – To send the composed message
 Receive Response – waits to receive response
 Decode Response <expected response code>– decodes
received response to compare with expected response code
and consequently sets the verdict to pass or fail
 Coap Setup <ipaddress, port>– To set up CoAP layer
 Coap TearDown – To teardown CoAP layer
Radisys Corporation Confidential 4
High level design

C API C API
Python Test Library (To add coap/http headers to (udp/tcp sockets to transfer
(Implementation of keywords xml payload for coap and http CoAP/HTTP messages to SUT)
in Python for creating XML library)
payload)
 
 

  C API C API
Python Test Library (To read header from (udp/tcp sockets to transfer
(Validate xml payload) received packet for coap CoAP/HTTP messages to
and http library) SUT)
 
 

Radisys Corporation Confidential 5


Installation Steps - Robot

sudo apt-get install python2.7 – (ensure no older or newer versions are already
installed)

sudo apt-get install python-wxgtk2.8

sudo apt-get install python-setuptools

sudo apt-get install python-pip python-dev build-essential

$ sudo pip install --upgrade pip

$ sudo pip install --upgrade virtualenv

sudo pip install robotframework

sudo pip install robotframework-ride

sudo apt-get install lxml*

Radisys Corporation Confidential 6


Installation Steps - Python

 Check python version installed on the system:


• #python –version

Ensure only python 2.7x version is installed. On most linux systems, python 2.7x version comes pre-
installed. If python 2.7x version is not installed, install it as shown below:

 Install dependencies:

 #sudo apt-get install build-essential


 #sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev
tk-dev libgdbm-dev libc6-dev libbz2-dev

 Download the source package:

 wget http://python.org/ftp/python/2.7.5/Python-2.7.5.tgz
 Extract and go to the directory tar -xvf Python-2.7.5.tgz
 cd Python-2.7.5
 Now install using :./configure
 sudo make install

 If python 3.x version is installed, it is better to remove it but not necessary.


 Reference : http://www.youtube.com/watch?v=MH4anq35I4o
Radisys Corporation Confidential 7
Installation Steps - Robot

[1] Installing Robot Framework


Installed using source code.
Link : https://code.google.com/p/robotframework/downloads/list
Download robotframework-2.7.7.tar.gz file
Followed below steps
tar –xvzf robotframework-2.7.7.tar.gz
cd robotframework-2.7.7
python setup.py install
 
[2] Installing wxPython (Dependent package for RIDE)
sudo apt-get install python-wxgtk2.8
 
[3] Installing RIDE
Installed using source code
Link: https://code.google.com/p/robotframework-ride/downloads/list
Download robotframework-ride-1.1.tar.gz
Followed below steps
tar –xvzf robotframework-ride-1.1.tar.gz
cd robotframework-ride-1.1
python setup.py install
 
[4] Installing lxml (Robot TCs dependent package)
sudo  apt-get install lxml*
 

Radisys Corporation Confidential 8


RIDE Snapshot

Radisys Corporation Confidential 9


Run Robot Test cases – Batch run

Compile Robot Execute “select Now follow on screen instructions, noted


C stub code: test case” script to below for your reference (instructions change
get started based on the options selected
> cd
4_Test/testBen
ches/Robot/80
x86/gcc_linux • Run command : > ride.py
> sh selectTest.sh
• Include Connection.py at suite level.
> make -f
RobotTest.mak • Set CoAP Setup at Suite Setup : CoAP Setup |
shared clean 127.0.0.1 | 61616

• Set CoAP TearDown at Suite Teardown : CoAP


make -f TearDown
RobotTest.mak
shared
• Run TCs using Start button in RIDE or press F8.

Radisys Corporation Confidential 10


Robot Batch run – Cont.…

Include
Connection.py at
suite level.

• Set CoAP Setup at Suite


Setup
• Set CoAP TearDown at
Suite Teardown

Include
Connection.py at
suite level.

Radisys Corporation Confidential 11


Run Robot Test cases – Particular resource
package

Compile Robot C stub Bring up ride and


Copy the <resource>.txt file to
code: run test cases
4_Test/testBenches/Robot/80x
86/gcc_linux

> cd Run command:


4_Test/testBench ride.py
es/Robot/80x86/g <resource>.txt.
cc_linux E.g. ride.py
cp ApplicationsTC.txt
/mnt/4_Test/testCases/Robot/
ApplicationsTC.txt
/mnt/4_Test/testBenches/Rob
> make -f ot/80x86/gcc_linux
RobotTest.mak Run TCs using
shared Start button in
RIDE or press F8.

Radisys Corporation Confidential 12


Robot – Test Results - Snapshot

Radisys Corporation Confidential 13


Bring up M2M Server and Gateway

Fetch the code


from svn /
clearcase.
Install libcurl for SVN client for
Install libxml for E.g. >
HTTP support: source code
xml library: sudo svn+ssh://pnatara
sudo apt-get management:
apt-get install j@172.24.2.70/var/
install libcurl4- sudo apt-get
libxml2-dev svn/m2m_repo/br
gnutls-Dev install subversion
anches/phase6/m
2m_sdp_3.00_rsy
s_intbr_5.20.0

Radisys Corporation Confidential 14


Bring up M2M Server and Gateway

Compile Server /
Export Library path, Register Gateway to
Gateway code, issue Start M2M Server Server and create
issue the below
the below commands and gateway m2mPoc resource
commands

Select the Manager


> cd > Cd > cd x-term of the
5_Applications/Se 5_Applications/Se 5_Applications/Se gateway, enter > m
rver_Gateway/buil rver_Gateway/rel rver_Gateway/rele (displays menu)
dAll/ ease/gcc_linux ase/gcc_linux

Enter > d (register


gateway with
> export server)
> make clean LD_LIBRARY_PA > ./server.sh start
TH=./

Select option > 1


for COAP and > 2
> ./gateway.sh for HTTP
> make
start

Select C to create
m2mpoc
All the SCs are started and
corresponding x-term’s pop
up.
Radisys Corporation Confidential 15
Thank You

You might also like