Integration Testing

From PKP Wiki
Revision as of 18:52, 27 October 2009 by Jerico.dev (Talk | contribs)

Jump to: navigation, search

Installing and Configuring your Web Test Environment

Firefox

Selenium tests can best be developed using a plug-in for the Firefox browser. This plug-in can record all actions you perform on a web page and replay them. It also contains an editor to manually extend or adapt your test cases.

Once the code Selenium code (they call it Selenese) has been developed, it can be executed in all browsers.

This means that you should have the latest version of Firefox installed.

Selenium IDE

Download the latest Selenium IDE Firefox Plugin from the Selenium Website. You won't find the word "Firefox" there. Just download "Selenium IDE", that's the plug-in.

Don't use the plug-in you might find on the Firefox add-on pages as this is often outdated.

Install the plug-in into FireFox.

Restart FireFox.

Selenium RC

Developing Web Tests (Tutorial)

Software environment

I used the following software configuration when I created this tutorial:

  • Firefox 3.5.3
  • Selenium IDE 1.0.2
  • Selenium RC 1.0.1
  • Eclipse Galileo with PDT 2.0
  • PHPUnit 3.4
  • PHP 5.2.11

Create "Selenese" for a test case

  • open Selenium IDE Sidebar
  • record your test in the Selenium IDE
  • Options->Format->PHP – Selenium RC
  • Copy the test code (only the test method) to the clipboard

Create a test case that extends OjsWebTest

  • copy the test code into the method
  • correct the following manually:
  • use assertTitleEquals(), assertLocationEquals(), etc. rather than assertEquals(..., $this->getTitle() / getLocation())
  • use waitForLocation() when you use redirects
  • if you used the waitForLocation command in Selenium IDE then replace the generated for loop with a call to waitForLocation()
  • use ...AndWait() rather than waitForPageToLoad()