|
|
@@ -30,10 +30,10 @@ Running tests
|
|
30
|
30
|
|
|
31
|
31
|
Oscar uses a nose_ testrunner which can be invoked using::
|
|
32
|
32
|
|
|
33
|
|
-.. _nose: http://nose.readthedocs.org/en/latest/
|
|
34
|
|
-
|
|
35
|
33
|
./runtests.py
|
|
36
|
34
|
|
|
|
35
|
+.. _nose: http://nose.readthedocs.org/en/latest/
|
|
|
36
|
+
|
|
37
|
37
|
To run a subset of tests, you can use filesystem or module paths. These two
|
|
38
|
38
|
commands will run the same set of tests::
|
|
39
|
39
|
|
|
|
@@ -54,7 +54,31 @@ To run an individual test, use one of::
|
|
54
|
54
|
|
|
55
|
55
|
Oscar's testrunner uses the progressive_ plugin when running all tests, but uses
|
|
56
|
56
|
the spec_ plugin when running a subset. It is a good practice to name your test
|
|
57
|
|
-cases and methods so that the spec output reads correctly.
|
|
|
57
|
+cases and methods so that the spec output reads correctly. For example::
|
|
|
58
|
+
|
|
|
59
|
+ $ ./runtests.py tests/unit/offer/benefit_tests.py:TestAbsoluteDiscount
|
|
|
60
|
+ nosetests --verbosity 1 tests/unit/offer/benefit_tests.py:TestAbsoluteDiscount -s -x --with-spec
|
|
|
61
|
+ Creating test database for alias 'default'...
|
|
|
62
|
+
|
|
|
63
|
+ Absolute discount
|
|
|
64
|
+ - consumes all lines for multi item basket cheaper than threshold
|
|
|
65
|
+ - consumes all products for heterogeneous basket
|
|
|
66
|
+ - consumes correct quantity for multi item basket more expensive than threshold
|
|
|
67
|
+ - correctly discounts line
|
|
|
68
|
+ - discount is applied to lines
|
|
|
69
|
+ - gives correct discount for multi item basket cheaper than threshold
|
|
|
70
|
+ - gives correct discount for multi item basket more expensive than threshold
|
|
|
71
|
+ - gives correct discount for multi item basket with max affected items set
|
|
|
72
|
+ - gives correct discount for single item basket cheaper than threshold
|
|
|
73
|
+ - gives correct discount for single item basket equal to threshold
|
|
|
74
|
+ - gives correct discount for single item basket more expensive than threshold
|
|
|
75
|
+ - gives correct discounts when applied multiple times
|
|
|
76
|
+ - gives correct discounts when applied multiple times with condition
|
|
|
77
|
+ - gives no discount for a non discountable product
|
|
|
78
|
+ - gives no discount for an empty basket
|
|
|
79
|
+
|
|
|
80
|
+ ----------------------------------------------------------------------
|
|
|
81
|
+ Ran 15 tests in 0.295s
|
|
58
|
82
|
|
|
59
|
83
|
.. _progressive: http://pypi.python.org/pypi/nose-progressive/
|
|
60
|
84
|
.. _spec: http://darcs.idyll.org/~t/projects/pinocchio/doc/#spec-generate-test-description-from-test-class-method-names
|