Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

running-tests.rst 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. =============
  2. Running tests
  3. =============
  4. Oscar uses a nose_ testrunner which can be invoked using::
  5. ./runtests.py
  6. .. _nose: http://nose.readthedocs.org/en/latest/
  7. To run a subset of tests, you can use filesystem or module paths. These two
  8. commands will run the same set of tests::
  9. ./runtests.py tests/unit/order
  10. ./runtests.py tests.unit.order
  11. To run an individual test class, use one of::
  12. ./runtests.py tests/unit/order:TestSuccessfulOrderCreation
  13. ./runtests.py tests.unit.order:TestSuccessfulOrderCreation
  14. (Note the ':'.)
  15. To run an individual test, use one of::
  16. ./runtests.py tests/unit/order:TestSuccessfulOrderCreation.test_creates_order_and_line_models
  17. ./runtests.py tests.unit.order:TestSuccessfulOrderCreation.test_creates_order_and_line_models
  18. Oscar's testrunner uses the progressive_ plugin when running all tests, but uses
  19. the spec_ plugin when running a subset. It is a good practice to name your test
  20. cases and methods so that the spec output reads well. For example::
  21. $ ./runtests.py tests/unit/offer/benefit_tests.py:TestAbsoluteDiscount
  22. nosetests --verbosity 1 tests/unit/offer/benefit_tests.py:TestAbsoluteDiscount -s -x --with-spec
  23. Creating test database for alias 'default'...
  24. Absolute discount
  25. - consumes all lines for multi item basket cheaper than threshold
  26. - consumes all products for heterogeneous basket
  27. - consumes correct quantity for multi item basket more expensive than threshold
  28. - correctly discounts line
  29. - discount is applied to lines
  30. - gives correct discount for multi item basket cheaper than threshold
  31. - gives correct discount for multi item basket more expensive than threshold
  32. - gives correct discount for multi item basket with max affected items set
  33. - gives correct discount for single item basket cheaper than threshold
  34. - gives correct discount for single item basket equal to threshold
  35. - gives correct discount for single item basket more expensive than threshold
  36. - gives correct discounts when applied multiple times
  37. - gives correct discounts when applied multiple times with condition
  38. - gives no discount for a non discountable product
  39. - gives no discount for an empty basket
  40. ----------------------------------------------------------------------
  41. Ran 15 tests in 0.295s
  42. .. _progressive: http://pypi.python.org/pypi/nose-progressive/
  43. .. _spec: http://darcs.idyll.org/~t/projects/pinocchio/doc/#spec-generate-test-description-from-test-class-method-names