| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- =============
- Running tests
- =============
-
- Oscar uses a nose_ testrunner which can be invoked using::
-
- ./runtests.py
-
- .. _nose: http://nose.readthedocs.org/en/latest/
-
- To run a subset of tests, you can use filesystem or module paths. These two
- commands will run the same set of tests::
-
- ./runtests.py tests/unit/order
- ./runtests.py tests.unit.order
-
- To run an individual test class, use one of::
-
- ./runtests.py tests/unit/order:TestSuccessfulOrderCreation
- ./runtests.py tests.unit.order:TestSuccessfulOrderCreation
-
- (Note the ':'.)
-
- To run an individual test, use one of::
-
- ./runtests.py tests/unit/order:TestSuccessfulOrderCreation.test_creates_order_and_line_models
- ./runtests.py tests.unit.order:TestSuccessfulOrderCreation.test_creates_order_and_line_models
-
- Oscar's testrunner uses the progressive_ plugin when running all tests, but uses
- the spec_ plugin when running a subset. It is a good practice to name your test
- cases and methods so that the spec output reads well. For example::
-
- $ ./runtests.py tests/unit/offer/benefit_tests.py:TestAbsoluteDiscount
- nosetests --verbosity 1 tests/unit/offer/benefit_tests.py:TestAbsoluteDiscount -s -x --with-spec
- Creating test database for alias 'default'...
-
- Absolute discount
- - consumes all lines for multi item basket cheaper than threshold
- - consumes all products for heterogeneous basket
- - consumes correct quantity for multi item basket more expensive than threshold
- - correctly discounts line
- - discount is applied to lines
- - gives correct discount for multi item basket cheaper than threshold
- - gives correct discount for multi item basket more expensive than threshold
- - gives correct discount for multi item basket with max affected items set
- - gives correct discount for single item basket cheaper than threshold
- - gives correct discount for single item basket equal to threshold
- - gives correct discount for single item basket more expensive than threshold
- - gives correct discounts when applied multiple times
- - gives correct discounts when applied multiple times with condition
- - gives no discount for a non discountable product
- - gives no discount for an empty basket
-
- ----------------------------------------------------------------------
- Ran 15 tests in 0.295s
-
- .. _progressive: http://pypi.python.org/pypi/nose-progressive/
- .. _spec: http://darcs.idyll.org/~t/projects/pinocchio/doc/#spec-generate-test-description-from-test-class-method-names
|