Ticket #4501: 4501_v6.diff

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