Home > Developers > Wiki > CheetahAcceptanceTests
Views

  • Firefox: For now, 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 as "Firefox" (its default) and call Firefox 3 something else.
  • 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 testing/ directory
  • Run all the tests:
  • mvn integration-test
  • 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 testing directory
  • mvn selenium:start-server -Pdev (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.

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