Home > Developers > Wiki > CheetahAcceptanceTests
Views


Prerequisites

Selenium

All dependencies except for Firefox 2 are installed automatically via Maven dependencies

Firefox

Right now Selenium runs only on Firefox 2, so you need Firefox 2 installed at the regular location for your operating system. Firefox 3 will be supported soon, the Selenium Maven Plugin snapshots reportedly support this. If you want to run Firefox 3 and only use Firefox 2 for the tests, you will need to install Firefox 2. How you do this depends on your operating system.

Windows, Mac, and Linux

By default, Selenium looks for the application named "Firefox", so install Firefox 2 in its normal location as "Firefox" (its default) and call Firefox 3 something else. On Linux, this means that 'firefox' needs to be on your $PATH, and point to Firefox 2.

Ubuntu Linux (alternative method)

If you're running an earlier version of Ubuntu, you may already have Firefox 2, otherwise you'll have to install it. Download the Firefox 2 tar ball into your local workspace, for example $HOME/dist/firefox-2/. After this, if Firefox 2 does not start with the command 'firefox', see MavenSettingsXml for information on how to communicate this to Maven.

HTTP Port

Acceptance tests currently run against port 8080, so stop any instance of tomcat you have running on port 8080 prior to executing the acceptance tests.

Running From The Commandline

  • cd to acceptanceTesting/ directory
  • Run all the tests:
  • mvn clean install
  • Run one test:
  • Start your Eclipse WTP server, or run mvn cargo:start-server -Pdev
  • Start Selenium: mvn selenium:start-server -Pdev
  • If your test requires initial sql data: mvn process-resources sql:execute -Pinsert-data
  • mvn integration-test -Dtest=TheNameOfYourTestClass

Running From Eclipse

  • start your Eclipse WTP tomcat server
  • start the Selenium server
  • cd to the acceptanceTests directory
  • mvn selenium:start-server -Pdev,tomcat6x,download-container (dev profile keeps the server running until stopped by a control-C)
  • In Eclipse:
  • run the TestNG acceptance test (bring up the test class, right-click on the editor, select "Run as test".)
  • Note that if you don't have a Run Configuration for the test, you may need to make one: Run > Run Configurations, select TestNG, click the New Configuration icon.

Slowing down the Selenium tests

  1. Open the Run Configuration entry for your TestNG test. (Run > Run Configurations, select the test you want to slow down.)
  2. Select the Arguments tab.
  3. Paste the following in the VM Arguments box: -Dmifos.selenium.delay="500"
  4. Click Apply, then Run.

This will take effect until you remove this argument.

The number is in milliseconds. This will add a 500ms delay to every action taken by Selenium by the acceptance test. You can change the "500" to any integer number of milliseconds you want.

How it works:

Spring now instantiates the DefaultSelenium bean called "selenium" that is used by the tests. SeleniumSpeedControl is an aspect that is applied to the selenium bean. It has a delay after every public method invocation. To activate it, you set a Java System Property called mifos.selenium.delay

Troubleshooting

  • When running from the commandline, if the cargo (tomcat) container start hangs, this means you probably have a local tomcat running, in Eclipse WTP or somewhere else. Stop it, stop the build, and try again.
  • If you want to manually verify things in the container are working, use maven to start it: mvn cargo:start -Pdev,tomcat6x,download-container This will start cargo and leave it running. You can then connect to it using a web browser.

Developing Acceptance Tests

  • Initial data can be loaded into the database by adding sql scripts to the root pom.xml's insert-data profile. These scripts should NOT alter the database structure.
  • Not seeing your changes? The acceptance tests use the latest war file from the local Maven repository, which is placed there by a mvn clean install in the application/ module.


Grameen logo