View source | Discuss this page | Page history | Printable version   
Toolbox
Main Page
Upload file
What links here
Recent changes
Help

PDF Books
Show collection (0 pages)
Collections help

Search

ERP 2.50:Automated Testing/Execute from command line

First, you need to have a working installation of Openbravo ERP.

Contents

Check out Openbravo ERP automation source code

To be able to clone Openbravo ERP testing code from main you need to install Mercurial.

Once Mercurial client is installed, move to the directory where you want to clone the last testing code tag and type in command line:

hg clone https://code.openbravo.com/tools/automation/pi/ pi

Move to pi/config directory and configure OpenbravoERPTest.properties.

Then, you need to install some things:

Execute Openbravo ERP tests

Execute a suite

You can use ant to execute the different tests suites already automated. The default execution is parallelized, but you can also run the tests sequentially.

Parallel execution

Our default suite execution uses Selenium Grid and the Ant parallel task in order to launch multiple tests at once and reduce the execution time as much as possible.

So, before launching the test suite you will have to prepare the environment and start the grid components.

First, create a Firefox profile for each Remote Controller that will be used on the execution. Otherwise, they will share the Openbravo session and everything will fail. The following command will create a new profile named "rc1":

firefox -no-remote -CreateProfile rc1

And it will return the path to that newly create profile, that will be required later. It's something like:

/srv/hudson/.mozilla/firefox/g2jc2ulk.rc1/prefs.js

Then, go to the automation branch folder and start the hub:

ant seleniumhub.start < /dev/null &

After that, start the Remote Controllers:

ant -Dport=5555 -DseleniumArgs="-firefoxProfileTemplate /srv/hudson/.mozilla/firefox/g2jc2ulk.rc1"

Some important things to note:

  • You can start as many Remote Controllers as your system supports. But with many RCs Selenium Grid might become unstable.
  • Every Remote Controller must use a different port. Specify the port with -Dport argument.
  • The path to the Firefox profile should not include the "/prefs.js" part.

Finally, you will be able to run the suite.

For example, with:

ant test.integration.smoke -f src-test/com/openbravo/test/integration/erp/testsuites/smoke/build.xml

ant will run the smoke test suite.

Sequential execution

There are two ways to run the tests sequentially:

This second option will not work with the default build file because it is now parallelized. Thus, many requests will get to the Selenium Server and as it is sequential it will be able to attend only one at a time, rejecting the rest.

We have kept a sequential build file for the smoke suite so we can execute it using the previous sequential components. But for the rest suites we will provide only the parallel ant build.

To run the smoke suite sequentially, run:

ant -Dsequential=true test.integration.smoke -f src-test/com/openbravo/test/integration/erp/testsuites/smoke/build.sequential.xml

We recommend to use the new parallel components, starting the grid and one or more RCs. This sequential execution is useful when you want to execute only one test, as explained in the next section.


Execute a test

You can run a specific test class with:

ant test.integration -Dsequential=true -Dtestclass=com.openbravo.test.integration.erp.testsuites.smoke.masterdata.ADM0000_Logging

replacing com.openbravo.test.integration.erp.testsuites.smoke.masterdata.ADM0000_Logging with the test class you want to run.

Note: The -Dsequential parameter is just to make the execution easier. You can omit it, but before running the test you must have started the Selenium hub and at least one Remote Controller

Running on a headless server

With XVFB

X virtual framebuffer can be used if the server that will be used to execute selenium tests has no X Window System.

To run the virtual framebuffer as display ":1", execute:

startx -- `which Xvfb` :1 -screen 0 1024x768x24 2>&1 >/dev/null &

Then, to run the tests do something like this:

DISPLAY=:1 ant test.integration.smoke


With TightVNC

The following instruction are specific to Ubuntu. Adjust them for your system.

 apt-get install tightvncserver icewm 
mkdir ~/.vnc
touch ~/.vnc/xstartup
chmod a+x ~/.vnc/xstartup
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid black
exec icewm-session
vncserver -geometry 1280x960 -depth 8
vncserver -kill :1
vncviewer dns.yourmachine.com:5901 

Retrieved from "http://wiki.openbravo.com/wiki/ERP_2.50:Automated_Testing/Execute_from_command_line"

This page has been accessed 13,082 times. This page was last modified on 3 April 2012, at 11:00. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.