Difference between revisions of "Robotframework"

From SME Server
Jump to navigationJump to search
Line 75: Line 75:
 
and click on the "zip" link, then you will get a zipped archive of all the scripts.
 
and click on the "zip" link, then you will get a zipped archive of all the scripts.
  
Unzip (extract) this into an empty directory, and then edit the "resource.robot" file to your own server URL and password.
+
Unzip (extract) this into an empty directory
 +
 
 +
Alternatively clone the git repository with:
 +
 +
git clone https://franka.through-ip.com/git/sme-test-automation.git
 +
 
 +
==Setting up the tests==
 +
 
 +
The "resource.robot" file in the top "sme" directory contains a number of variables and macros that are used by the test scripts.
 +
 
 +
The key ones that you need to change are:
 +
 
 +
${SERVER NAME}      sme9-64
 +
${SERVER DOMAIN}    through-ip.com
 +
${VALID PASSWORD}    Admin-Test-1234
  
 
Note that the URL must be same as the FQDN for the server, as it uses this as a test on the title of the logged server manager web page.
 
Note that the URL must be same as the FQDN for the server, as it uses this as a test on the title of the logged server manager web page.
  
CD into the directory and run the complete set of server-manager test with:
+
The tests assume that the ${SERVER NAME}.${SERVER DOMAIN} resolve to the correct IP of that server. I typically setup entries for test servers with a host name entry on my main server.
  
pybot 02__server-manager
+
==Running the tests==
  
you can run the ftp test by
+
The tests are setup in an hierarchical fashion. To run all tests:
  
  pybot 03__remote_access/02__ftp/
+
  pybot sme
 +
 
 +
To run a subset of the tests use:
 +
 
 +
pybot sme/02__server-manager
 +
 
 +
or for the ftp tests:
 +
 
 +
pybot sme/03__remote_access/02__ftp/
  
 
and ssh by
 
and ssh by
  
  pybot 03__remote_access/03__ssh/
+
  pybot sme/03__remote_access/03__ssh/
 +
 
 +
==RIDE==
 +
 
 +
The Robotframework has its own IDE called RIDE. It is particularly useful for running individual tests.
 +
 
 +
Info here:
 +
 
 +
https://github.com/robotframework/RIDE/wiki
 +
 
 +
and can be easily installed with:
 +
 
 +
pip install robotframework-ride
 +
 
 +
and then run RIDE with:
 +
 
 +
  ride.py sme

Revision as of 08:27, 10 March 2014

Robotframework

Page documenting the setup and possible The use of robotframework for regression testing of SMEServer.

Page Initial creation by Brian J Read - 3rd March 2014

Installation

Initial installation is on the back of a Centos 6.5 (64 bit in my case) install. I use Virtual Box under Linux Mint 16.

  1. Install Centos 6.5
  2. login as root
  3. Install robotframework:
yum install make automake gcc gcc-c++ kernel-devel git-core –y
yum install python-devel -y
curl -o /tmp/ezsetup.py https://sources.rhodecode.com/setuptools/raw/bootstrap/ez_setup.py
python /tmp/ezsetup.py
/usr/bin/easy_install pip
rm setuptools-*.tar.gz
pip install -i https://pypi.rhodecode.com/ --upgrade pip
pip install robotframework
pip install virtualenv

Install additional robot framework libraries:

pip install robotframework-selenium2library
pip install robotframework-ftplibrary
pip install robotframework-sshlibrary

Note that selenium needs a browser to drive, so you'll need to install a graphical GUI, you can do this by:

yum -y groupinstall "Desktop" "Desktop Platform" "X Window System" "Fonts"
yum -y groupinstall "Graphical Administration Tools"
yum -y groupinstall "Internet Browser"
yum -y groupinstall "General Purpose Desktop"

If you want to start it up automatically, then instructions are here

else just type:

startx

After command line logging in.

You also ought to create a user to run under - you can use the graphical admin user prgram from the above, and then login as that.

Robotframework Demos

There are ssh, ftp and web (selenium) demos at:

http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.html?r=2.8.4#demonstrations

https://bitbucket.org/robotframework/webdemo/wiki/Home#rst-header-starting-demo-application

https://robotframework-sshlibrary.googlecode.com/git-history/2.0/doc/SSHLibrary.html

http://sourceforge.net/projects/rf-ftp-py/files/1.2/FtpLibraryExample.txt/download

Making it test SMEServer

Marco Hess has made good progress with getting the framework to talk to an SMEServer.

His code is here:

https://franka.through-ip.com/git/?p=sme-test-automation.git;a=summary

and I can confirm that it also works on my setup.

Loading and Trying it

If you use this link:

https://franka.through-ip.com/git/?p=sme-test-automation.git;a=tree

and click on the "zip" link, then you will get a zipped archive of all the scripts.

Unzip (extract) this into an empty directory

Alternatively clone the git repository with:

git clone https://franka.through-ip.com/git/sme-test-automation.git

Setting up the tests

The "resource.robot" file in the top "sme" directory contains a number of variables and macros that are used by the test scripts.

The key ones that you need to change are:

${SERVER NAME}       sme9-64
${SERVER DOMAIN}     through-ip.com
${VALID PASSWORD}    Admin-Test-1234

Note that the URL must be same as the FQDN for the server, as it uses this as a test on the title of the logged server manager web page.

The tests assume that the ${SERVER NAME}.${SERVER DOMAIN} resolve to the correct IP of that server. I typically setup entries for test servers with a host name entry on my main server.

Running the tests

The tests are setup in an hierarchical fashion. To run all tests:

pybot sme

To run a subset of the tests use:

pybot sme/02__server-manager

or for the ftp tests:

pybot sme/03__remote_access/02__ftp/

and ssh by

pybot sme/03__remote_access/03__ssh/

RIDE

The Robotframework has its own IDE called RIDE. It is particularly useful for running individual tests.

Info here:

https://github.com/robotframework/RIDE/wiki

and can be easily installed with:

pip install robotframework-ride

and then run RIDE with:

 ride.py sme