Вы находитесь на странице: 1из 20

Robot Framework USER GUIDE

Robot Framework + EMAAF

July 2015

Version 1.00

Printed and downloaded copies of this document are not controlled and may be
used as reference documents only. Any copies should be checked for accuracy
against the master document on Sharepoint.
©2015 ZIH Corp and/or its affiliates. All rights reserved. Zebra and the stylized
Zebra head are trademarks of ZIH Corp., registered in many jurisdictions
worldwide. All other trademarks are the property of their respective owners.
iProtect Status: Zebra Technologies Confidential – Do Not Redistribute

Documentation: Shankar Kumar Yelapu (MCT483)


Reviewed: Satheesh Sarthi Ningappa (CBFM47)
Approved: Arun Kumar Wuppuluri (BMF734)
©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE

Third party Copyrights as mentioned below:

Copyright 2008-2014 Nokia Solutions and Networks

Licensed under the Apache License, Version 2.0 (the "License");


you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software


distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
See the License for the specific language governing permissions and
limitations under the License.

Copyright ©2001-2015. Python Software Foundation Legal Statements Privacy


Policy

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE
Document Revisions

Version
Date Document Changes
Number

20/07/2015 1.0 Initial Draft

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE

Table of Contents
1 Introduction ................................................................................................................................................................
1.1 .....Scope and Purpose ................................................................................................................................................................
1.2 .....System Requirements ..........................................................................................................................................................
2 Installation...................................................................................................................................................................
2.1 .....Installing Python ...................................................................................................................................................................
2.1.1 Installation of Python: .................................................................................................................................................................
2.1.2 Setting up path variables for Python:...................................................................................................................................
2.2 .....Installation of Robot Framework ..................................................................................................................................
3 Test suite template..................................................................................................................................................
4 Commands to run Automation .........................................................................................................................
5 Preconditions before executing corresponding Test plans…………………………………………....

5.1…..Data Wedge……………………………………………………………………………………………………………………...

5.2…..Readiness…………………………………………………………………………………………………………………………

5.2…..EHS………………………………………………………………………………………………………………………………….

5.2…..QFE-AndroidCompliance…………………………………………………………………………………………………..

5.2…..MX-MDM………………………………………………………………………………………………………………………….

5.3…..OOB………………………………………………………………………………………………………………………………….

6 Results and Logs……………………………………………………………………………………………………………...

7 Appendices………………………………………………………………………………………………………………………

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE
1 Introduction
1.1 Scope and Purpose
Robot Framework is a Python-based, extensible keyword-driven test
automation framework for end-to-end acceptance testing and acceptance-
test-driven development (ATDD). It can be used for testing distributed,
heterogeneous applications, where verification requires touching several
technologies and interfaces, extended with our EMAAF Library

1.2 System Requirements

Operating System: Windows 7 and above


Processor: Pentium and above

RAM: Minimum 2GB

Hard disk: 20GB and above

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE

2 Installation
Robot Framework is supported on Python, Jython (JVM)
and IronPython (.NET) and runs also on PyPy. The interpreter you want to
use should be installed before installing the framework.
2.1 Installing Python
Robot Framework currently supports Python versions 2.5, 2.6, and 2.7.
2.1.1 Installation of Python:
Download Python 2.7 and Run executable file as administrator.

 Run the file


 Select install for all users or install just for me, click Next
 You’ll see it installs under the C:\Python27 folder, click Next
 Click Next again for the 'Customize Python' step
 Click Finish

2.1.2 Setting up path variables for Python:

On Windows you can configure PATH by following the steps below. Notice that
the exact setting names may be different on different Windows versions, but
the basic approach should still be the same.

1. Open Start > Settings > Control Panel > System > Advanced >
Environment Variables.There are User variables and System
variables, and the difference between them is that user variables affect
only the current users, whereas system variables affect all users.
2. To edit an existing PATH value, select Edit and
add ;<InstallationDir>;<ScriptsDir> at the end of the value
(e.g. ;C:\Python27;C:\Python27\Scripts). Note that the semicolons (;)
are important as they separate the different entries. To add a
new PATH value, select New and set both the name and the value, this time
without the leading semicolon.
3. Exit the dialog with Ok to save the changes.
4. Start a new command prompt for the changes to take effect.

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE
2.2 Installation of Robot Framework
Download RF from the link ROBOT and
Right click on robotframework-2.8.7.win-amd64.exe and Run as administrator
Click on Run as shown below.

Then you will get a screen like:

Click on “Next”

Then you will be redirected to a screen like:


©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE

Click on “Next” and Make sure that Robot detected the Python Installation Directory

Click “Next”

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE

Click “Finish”
Robot Framework installed successfully.

2.3 Installation of EMAAF Library


Go to Functional Automation

Copy the folder to your Local path:


Open Command prompt and check python and pybot versions with following commands.
python --version  prints current python version
pybot –version  prints current Robot version and on which version its running as shown
below.

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE

Now , execute following command to merge EMAAF Library into Robot Framework.

python setup.py install

It will shows as below:

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE
Now you are ready to run Automation using Robot Framework with our EMAAF Library

3 Test suite template

Test suite template suite will be as shown below:

| *Setting* |
| Library | emaaflib |
| Force Tags | Regression Level |

| Suite Setup | Init EMAAF Setup |

| *Variable* |
| ${PRIMARYDEVICE} |
| ${SECONDARYDEVICE1} |
| ${SECONDARYDEVICE2} |
| ${SECONDARYDEVICE3} |
| @{SUPPORTINGDEVICES} | ${SECONDARYDEVICE1} | ${SECONDARYDEVICE2} | ${SECONDARYDEVICE3} |
| ${HOSTPATH} |

| ***Test Cases*** |
| Test case Id | [Documentation] | Test Case-Number Followed by Case Descrption|
| | setTestCaseId | VT244-0001 |
| | LAUNCH_APP | Settings |
| | SLEEP | 1 |

| *Keywords* |
| Init EMAAF Setup |
| | ConnectDevice1 | ${PRIMARYDEVICE} |
| | SetEmaafPath | ${HOSTPATH} |
| | EmaafSetup | ${HOSTPATH} |

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE

4 Commands to run Automation


Currently the following commands been used for the Execution:
To Execute a test plan: pybot -v PRIMARYDEVICE:DEVICE_ID -v
HOSTPATH:PATH_CONTAINS_TESTFILES TEST_SUITENAME

E.g.: pybot -v PRIMARYDEVICE:206081a1 -v


HOSTPATH:C:\Users\xxxx\PycharmProjects\emaaflib\Dummy MX_MC40.robot

To re-execute the failed test cases: pybot -v PRIMARYDEVICE:DEVICE_ID -v


HOSTPATH:PATH_CONTAINS_TESTFILES --rerunfailed output.xml --output rerun.xml
TEST_SUITENAME

E.g: pybot -v PRIMARYDEVICE:206081a1 -v


HOSTPATH:C:\Users\xxxx\PycharmProjects\emaaflib\Dummy --rerunfailed output.xml --
output rerun.xml MX_MC40.robot

To merge the rerun test results: rebot --merge output.xml rerun.xml

To run particular test case from the test suite: pybot –t VTID -v
PRIMARYDEVICE:DEVICE_ID -v HOSTPATH:PATH_CONTAINS_TESTFILES
TEST_SUITENAME

E.g: pybot -v PRIMARYDEVICE:206081a1 -v


HOSTPATH:C:\Users\xxxx\PycharmProjects\emaaflib\Dummy –t VT244-0001
MX_MC40.robot

Please make sure all the commands are executing from the path where the test suite
located, otherwise you can mention the path in place TEST_SUITENAME including the test
suite name.

Notes:

DEVICE_ID : Serial number of the DUT

VTID : VTID as mentioned in the test suite.

PATH_CONTAINS_TESTFILES : Path from where Robot Framework fetch files required for
the test execution Eg. “C:\Users\xxxx\Desktop\MC40\Merged\R1andR2\eMaafFiles”

TEST_SUITENAME: test suite name which you are going to run automation or path for the
test suite

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE
5 Preconditions before Executing corresponding Test plans
Download Automation dependencies and corresponding Test suites from the link:
AutomationDependency.zip

5.1 Data Wedge

Preconditions:
1. Barcode Display utility must be installed on the PC.
2. All the barcodes required should be present in the PC.
3. The DW folder which contains all the required files to run the Data wedge
automation should be present inside the host folder.
4. All the required APK present inside the DW folder must be installed on the
Device.(Can be done by running the installApp.bat)
5. Please make sure all the applications in the batch file are installed properly
before starting execution.
6. Host folder should be till e.g.
“C:\Users\xxxx\Desktop\AutomationDependency\DW”

Steps:
1. Launch the Barcode Display Utility.
2. Under General settings browse and select the folder where the barcodes are
located.

3. Under Connection Settings set DUT IP as 127.0.0.1 and net port as 1000.
4. Click on the Start Button and a message “Waiting for connection” will be seen
under Message.

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE

5. Minimize the Barcode display utility.


5.2 Readiness

Preconditions:
1. The Readiness folder which contains all the required files to run the
Readiness automation should be present inside the host folder.
2. Host path should be till e.g.
“C:\Users\xxxx\Desktop\AutomationDependency\”

5.3 EHS

Preconditions:
1. The EHS folder which contains all the required files to run the EHS
automation should be present inside the host folder.
2. Host path should be till e.g.
“C:\Users\xxxx\Desktop\AutomationDependency\”

Steps:
1. Factory reset the DUT
2. Launch Settings and enable the following options:
a. Developer options
i. (i)USB debugging
ii. (ii)Stay awake
b. Security
i. Screen Lock: None
3. On DUT, Install the latest EHS.apk
4. Press Home, Select EHS and Always
5. 5. Go to preferences in EHS admin mode and disable the “USB debugging
disabled” option

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE
5.4 QFE Android Compliance

Preconditions:
1. The AndroidCompliance folder which contains all the required files to run
the QFE automation should be present inside the host folder.
2. Host path should be till e.g.
“C:\Users\xxxx\Desktop\AutomationDependency\”

Steps:
1. Factory reset the DUT
2. Launch Settings and enable the following options:
Developer options:
(i)USB debugging
(ii)Stay awake
Security
(i)Screen Lock: None
1. On Primary DUT, Connect to some Profile with Internet access
2. For Moonlight devices: Connect one secondary device

3. For running DataWedge test cases, please follow the below mentioned steps:

4. Launch the Barcode Display Utility.


5. Under General settings browse and select the folder where the barcodes are
located.

6. Under Connection Settings set DUT IP as 127.0.0.1 and net port as 1000.
7. Click on the Start Button and a message “Waiting for connection” will be seen
under Message.
©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE

8. Minimize the Barcode display utility.


9. Edit all the batch files with appending the Serial Id of the device to be tested
for the files inside the Android Compliance folder.
Eg. adb -s 14303523028845 shell sendevent /dev/input/event0 4 4 0

5.5 MX-MDM

Preconditions:
1. The MX folder which contains all the required files and sub folders to run the
MX automation should be present inside the host folder.
2. Host path should be till e.g.
“C:\Users\xxxx\Desktop\AutomationDependency\”

Steps:
1. Factory reset the DUT
2. Launch Settings and enable the following options:
Developer options:
(i)USB debugging
(ii)Stay awake
Copy music 2 music files into Enterprise partition or sdcard on the device.
3. Edit the corresponding device serial number in the push_cert.bat , if you
connect more than one device on your desktop.
4. Run push_cert.bat by double clicking on it.
5. Check whether the corresponding certificate installed or not on the device,
you can check the same by opening Results.xml inside Certs folder
6. Run the command from the command line where the test suite is placed.

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE
5.5 OOB

Preconditions:
1. The “OOB” and “Readiness” folder which contains all the required files to run the OOB
test plan automation should be present inside the host folder.

Steps:
1. Factory reset the DUT
2. Launch Settings and enable the following options:

Developer options:
(i)USB debugging
(ii)Stay awake
Security
(i)Screen Lock: None

3. On Primary DUT, Connect to some Profile with Internet access


4. Connect one secondary device with Internet access.

Command to run with Secondary device:


E.g. pybot -v PRIMARYDEVICE:206081a1 -v SECONDARYDEVICE1:1234567 –v
HOSTPATH:C:\Users\xxxx\PycharmProjects\emaaflib\Dummy -b Results.html
MX_MC40.robot

Execution can be observed from the command line as shown below:

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE
Note: If you are re running MX-MDM failed test cases using RF please make
sure all the preconditions would have as a fresh run.

6 Results and Logs


Results will be generated after the completion of entire execution in two different files one
is report.html and the other one is log.html.

Report.html shows the summary of the test plans ran and the consolidated result with an
appropriate background color.

For e.g. Green for 100% pass and Red if there are any failures as shown below.

An example for a successful execution of the test suite:

An example for failed execution

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE
To analyze the failures click on the LOG to get the detailed execution steps and failure
report analysis.

For each failed test case, you can observe a screenshot followed by logcat logs in the
log.html as shown below:

All the screenshots and log files can be found at the host path specified while starting the
execution.

For example, C:\Users\xxx\Desktop\Auomation\ is your host path then your failure data
will be C:\Users\xxx\Desktop\Auomation\DEVICE_ID\TestCase_ID

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use
Robot Framework USER GUIDE

If anybody wants to know the results during the execution please add the command line
argument before test suite name as “–b Results.html”.

E.g. pybot -v PRIMARYDEVICE:206081a1 -v


HOSTPATH:C:\Users\xxxx\PycharmProjects\emaaflib\Dummy -b Results.html
MX_MC40.robot

This is a debug file from Robot Framework to know the results at the runtime.

7 Appendices

http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html

EMAAF Keyword Library

©2015 ZIH Corp All rights reserved. Zebra Technologies Confidential – Do Not
Redistribute
Unless marked otherwise, printed copies are uncontrolled – Verify current revision before use

Вам также может понравиться