Skip to end of metadata
Go to start of metadata

Purpose: help developers who would like to run the current test suite or create new tests for the mapbuilder library.

MapBuilder Selenium tests

MapBuilder uses Selenium for acceptance testing. To this end, the Selenium Core is included in the MapBuilder development tree, under mapbuilder/tests/selenium/selenium-core-x.y.z/ (currently version 0.8.2).

Running the current Selenium test suite

To run the current Selenium test suite, simply deploy MapBuilder from the source tree, and open http://localhost:8080/mapbuilder/tests/selenium/ in your browser. This will redirect you to the Selenium TestRunner and load the initial TestSuite.html.

Layout of the Selenium tests

The directory structure of the Selenium tests is as follows:

mapbuilder/tests/selenium/                           - root of all things Selenese
mapbuilder/tests/selenium/selenium-core-x.y.z/       - copy of the current version of the Selenium Core
mapbuilder/tests/selenium/index.html                 - convenience page to redirect to the Selenium TestRunner
mapbuilder/tests/selenium/tests/TestSuite.html       - the complete test suite for MapBuilder
mapbuilder/tests/selenium/tests/examples/            - tests for the example applications
mapbuilder/tests/selenium/tests/examples/i18n/       - tests for the I18n example
mapbuilder/tests/selenium/tests/examples/i18n/*.html - HTML files containing Selenium tests for each separate aspect to test from the example

Adding tests

If you want to add additional tests for a specific demo, add them in the directory for that demo, and add them to the TestSuite.html at the right place (most likely near the other tests for that demo).

If you want to add tests for a new demo, make a new directory for that demo, and add files for each aspect that you want to test. Then, add those tests to the TestSuite.html at an appropriate place.

Adding specific test suites

It is also possible to add specific test suites, e.g. a set of (related) tests for testing a specific part of MapBuilder, say the History functionality. For this, create a new test suite in the mapbuilder/tests/selenium/tests/ directory, and give it a meaningful name like HistoryTestSuite.html.

Writing tests

For getting up to speed with Selenium, see the Selenium Core documentation.

The easiest way to develop Selenium tests is by using Firefox and the Selenium IDE Firefox plugin. Other useful Firefox plugins are XPather and/or XPath Checker. Note that the browser you use to develop the tests is independent of the browsers you can run the tests in; Selenium is browser-independent; see the Selenium site for the latest list of supported platforms.

Have a look at the other tests to see how to use Selenium. Experiment. Run your tests under different browsers. And don't be afraid to ask questions on the mapbuilder-devel mailing list.

  • No labels