Diff for "Testing"

Not logged in - Log In / Register

Differences between revisions 21 and 22
Revision 21 as of 2010-04-22 22:14:04
Size: 3672
Editor: adiroiban
Comment:
Revision 22 as of 2010-05-27 15:24:08
Size: 3934
Editor: adiroiban
Comment:
Deletions are marked like this. Additions are marked like this.
Line 92: Line 92:
= Performance and stress tests =

== Populate the db ==

To add object into the database you can use:

& env LP_DBNAME="launchpad_dev" make iharness
from canonical.lp import initZopeless
zl = initZopeless()
#
# use the factory here
#
zl.commit()

This page is an introduction to writing and running test. All pages dedicated to testing can be found in CategoryTesting.

Writing tests

For each part of an application there are 2 level of testing:

  • unit testing
    • comprehensive testing, including cornerstone cases
    • written in python files (try to avoid doctest)
  • smoke/functional/integration testing
    • testing normal use cases
    • written using doctest format

Model

  1. Unit testing
    • Files locate in lib/lp/<application>/scripts/tests

  2. Integration testing
    • Files locate in lib/lp/<application>/doc

View

  1. Unit/integration testing
    • Files locate in lib/lp/<application>/browser/tests

  2. Smoke testing
    • Files locate in lib/lp/<application>/stories

    • More details: PageTests

Javascript

  1. Unit testing
  2. Smoke testing
    • Files locate in lip/lp/<application>/windmill (if written in Python) and lib/canonical/launchpad/windmill/jstests (if written in JS)

    • More details: Windmill

Scripts

  • Files locate in lib/lp/<application>/scripts/tests

API

  • Files located in lib/lp/<application>/stories/webservices

  • More details: TestingWebServices

Testing Your Launchpad Changes

This page is very much still in progress.

You might also be interested in Debugging Launchpad.

General usage

The normal pattern for testing your changes is to run the tests you think will be affected locally, and then (possibly just before submission) run all the tests in the cloud before landing your changes on trunk.

To run the tests, you run the ./bin/test script, which is produced by make build.

You can see all the options you have by running ./bin/test --help.

Usually you will run ./bin/test -vvct PATTERN where PATTERN is a regular expression that is used to filter the tests that will be run.

You can use '!PATTERN' to match all expression not matching that patter. Ex, to run all test, except the one at Windmill layer you can use:

./bin/test -vvc --layer '!Windmill'

Speed up the tests

Since Librarian and MemCache does not change often and they take a long time to be started and shutdown, ./bin/test can leave them started by using this command:

LP_PERSISTENT_TEST_SERVICES=1 ./bin/test PATTERN 

You can kill them using  ./bin/kill-test-services 

When running tests written in python files, and you only want to test a file, you can speed up the test by specifying the full path to the python file:

LP_PERSISTENT_TEST_SERVICES=1 ./bin/test PATH/TO/PYTHON/TEST/FILE.py

See this mail for more.

Headless Windmill tests

  • In case you are running windmill test on a machine without X server, you can use xvfb-run to run WindmillTests:

xvfb-run -s '-screen 0 1024x768x24' bin/test YOUR_TEST_ARGUMENTS

Testing Launchpad Translations

  • Rosetta admin user - translations-deity@example.com

  • Pagetest browser setup for Rosetta Administrators rosetta_admin_browser = setupRosettaExpertBrowser()

  • Pagetest browser setup for Ubuntu Translation Administrators ubuntu_admin_browser = setupDTCBrowser()

Performance and stress tests

== Populate the db ==

To add object into the database you can use:

& env LP_DBNAME="launchpad_dev" make iharness from canonical.lp import initZopeless zl = initZopeless() # # use the factory here # zl.commit()


CategoryTesting

Testing (last edited 2020-07-16 16:51:31 by doismellburning)