Changes between Version 21 and Version 22 of TracDev/UnitTests
- Timestamp:
- Nov 18, 2016, 5:55:12 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracDev/UnitTests
v21 v22 3 3 = Trac Unit Tests 4 4 5 Many of the Trac Python modules are accompanied by unit tests. You should run the tests whenever making changes, to be confident you haven't broken anything. Note though that the coverage of application code by the unit tests is still rather poor, and even if it were better,not having broken the unit tests does not mean you haven't broken the application! Unit tests do not replace manual testing.5 Many of the Trac Python modules are accompanied by unit tests. You should run the tests whenever making changes, to be confident you haven't broken anything. Note though that the coverage of application code by the unit tests is incomplete, so not having broken the unit tests does not mean you haven't broken the application! Unit tests do not replace manual testing. 6 6 7 7 Ideally, also include new unit tests for a change or enhancement, even if you are just submitting a patch. Patches that break the unit tests are a lot less likely to get integrated than patches that add unit tests for the new or changed functionality. … … 11 11 You can run the unit tests from the command line by executing: 12 12 {{{#!sh 13 python -m trac.test --skip-functional-tests13 $ python -m trac.test --skip-functional-tests 14 14 }}} 15 15 … … 28 28 Assuming the current working directory is where you checked out the Trac code from the SubversionRepository. 29 29 30 This will run all the unit tests, but you can also run only th ose tests for a specific package or module. For example, to run the unit tests for the {{{trac.versioncontrol}}}package, execute:30 This will run all the unit tests, but you can also run only the tests for a specific package, module, class or method. For example, to run the unit tests for the `trac.versioncontrol` package, execute: 31 31 {{{#!sh 32 python -mtrac.versioncontrol.tests.__init__32 $ python -m unittest trac.versioncontrol.tests.__init__ 33 33 }}} 34 34 … … 38 38 }}} 39 39 40 To run the unit tests for the {{{trac.versioncontrol.cache}}}module, execute:40 To run the unit tests for the `trac.versioncontrol.cache` module, execute: 41 41 {{{#!sh 42 python -mtrac.versioncontrol.tests.cache42 $ python -m unittest trac.versioncontrol.tests.cache 43 43 }}} 44 44 … … 46 46 {{{#!sh 47 47 $ PYTHONPATH=. trac/versioncontrol/tests/cache.py 48 }}} 49 50 To run the unit tests for the test class `trac.versioncontrol.tests.cache.CacheTestCase`, execute: 51 {{{#!sh 52 $ python -m unittest trac.versioncontrol.tests.cache.TestCase 53 }}} 54 55 To run the test case `trac.versioncontrol.tests.cache.CacheTestCase.test_initial_sync`, execute: 56 {{{#!sh 57 $ python -m unittest trac.versioncontrol.tests.cache.TestCase.test_initial_sync 48 58 }}} 49 59