Ticket #4501: 4501_v5.diff

File 4501_v5.diff, 1.7 KB (added by Christopher Medrela, 13 years ago)
  • docs/topics/testing.txt

    diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt
    index dc5bf7e..daa072d 100644
    a b failed and erroneous tests. If all the tests pass, the return code is 0. This  
    552552feature is useful if you're using the test-runner script in a shell script and
    553553need to test for success or failure at that level.
    554554
     555Integration with coverage.py module
     556-----------------------------------
     557
     558Code coverage describes how much source code have been tested. It indicates
     559quality of your tests - the better code coverage is, the more lines are covered
     560by tests and the better tests are. It's important part of testing applications,
     561so it's strongly recommended to check coverage.
     562
     563Django can be easily integrated with `coverage.py module`_. First, you have to
     564`install coverage.py`_. Now you are ready to use coverage module.
     565When you are in your project folder, type in your shell:
     566
     567.. _coverage.py module: http://nedbatchelder.com/code/coverage/
     568.. _install coverage.py: http://pypi.python.org/pypi/coverage
     569
     570.. code-block:: bash
     571
     572   coverage run --source='.' manage.py test myapp
     573
     574Now tests were launched and coverage data of all executed files in your project
     575folder was collected. You can see a report by typing following command:
     576
     577.. code-block:: bash
     578
     579   coverage report
     580
     581Note that some of django code was executed during running tests, but
     582it was not listed here because of flag ``source`` given to previous command.
     583
     584After this all don't forget to delete all collected data by typing:
     585
     586.. code-block:: bash
     587
     588   coverage erase
     589
     590Note that if you don't run last command, coverage data from next launching
     591will be append to existing data.
     592
    555593Testing tools
    556594=============
    557595
Back to Top