Auto-tools/Projects/Mozbase: Difference between revisions

Line 82: Line 82:


* each mozbase package should have tests in a 'tests' subdirectory of its root  
* each mozbase package should have tests in a 'tests' subdirectory of its root  
**''Example'': https://github.com/mozilla/mozbase/tree/master/mozprofile/tests
**''Example'': http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/mozprofile/tests/
* these should be self-executing [http://docs.python.org/library/unittest.html python unittests]
* these tests should be contained in a manifest; the master [http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/test-manifest.ini test manifest], is executed via [http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/test.py test.py]
**''Example'': https://github.com/mozilla/mozbase/blob/master/mozprofile/tests/testprofile.py
* these tests should be contained in a manifest; the master test manifest, https://github.com/mozilla/mozbase/blob/master/test-manifest.ini , is executed via [https://github.com/mozilla/mozbase/blob/master/test.py test.py]


==== Running the tests ====
==== Running the tests ====
Line 93: Line 91:
Ensure that all mozbase packages are installed as the tests require them as well as 3rd party packages using 'python setup_development.py --extra'.
Ensure that all mozbase packages are installed as the tests require them as well as 3rd party packages using 'python setup_development.py --extra'.


Then run the [https://github.com/mozilla/mozbase/blob/master/test.py test.py] test runner from the root of the git repository:
Then run the [http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/test.py test.py] test runner from the root of the git repository:


     python test.py
     $ python test.py


This will run all tests from [https://github.com/mozilla/mozbase/blob/master/test-manifest.ini test-manifest.ini] which is parsed with [https://github.com/mozilla/mozbase/tree/master/manifestdestiny ManifestDestiny].  On success 'test.py' should print the number of tests run and 'OK':
This will run all tests from [http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/test-manifest.ini test-manifest.ini] which is parsed with [http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/manifestdestiny ManifestDestiny].  On success 'test.py' should print the number of tests run and 'OK':


     ----------------------------------------------------------------------
     ----------------------------------------------------------------------
Line 122: Line 120:
'''Third-party Packages Used in Mozbase Testing:'''
'''Third-party Packages Used in Mozbase Testing:'''
* mock
* mock


In general, additional requirements add overhead to code complexity, new contributor learning curve, maintenance cost, and portability, so the value added should justify the costs.  Candidate packages should be discussed with Mozbase stakeholders preferably in a bug so that a record is kept.
In general, additional requirements add overhead to code complexity, new contributor learning curve, maintenance cost, and portability, so the value added should justify the costs.  Candidate packages should be discussed with Mozbase stakeholders preferably in a bug so that a record is kept.
Confirmed users
656

edits