Testing¶
Important
This document has been migrated from our old wiki as is, and has not yet been revised. The content might be outdated, links and images could be broken. We are aware and will fix any issues as soon as possible.
Testing your Launchpad changes¶
The normal pattern for testing your changes is to run the tests you think will be affected locally, but fundamentally, we rely on post-merge testing by buildbot.
For instructions on running test suite locally, including selecting specific tests and layers, speeding up runs, and running browser tests headless, see Running tests.
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()
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¶
Unit testing
Files locate in lib/lp//scripts/tests
Integration testing
Files locate in lib/lp//doc
View¶
Unit/integration testing
Files locate in lib/lp//browser/tests
More details: ViewTests
Smoke testing
Files locate in lib/lp//stories
More details: PageTests
JavaScript¶
Unit testing
More details: TestingJavaScript JavascriptUnitTesting
XHR integration testing
Use sparingly.
We use YUI tests with a full appserver behind it.
See standard_yuixhr_test_template.js and standard_yuixhr_test_template.py in the root of the Launchpad tree.
Scripts¶
Files locate in lib/lp//scripts/tests
API¶
Files located in lib/lp//stories/webservices
More details: TestingWebServices