Check test coverage in Django code with Coveralls

Coverage:

It is a tool used for showing the percentage of your codebase covered by tests.

Test Coverage is an important indicator of software quality and an essential part of software maintenance. It helps in evaluating the test cases by providing the data on different coverage items. It is a useful tool for finding untested part of a code.

Test coverage can help in monitoring the quality of testing and assist in directing the test generators to create test cases that cover areas that have not been tested. It helps to measure the quality and identifies unnecessary test cases which will not increase coverage.

Benefits of Test Coverage:

  • Defect prevention in the project.
  • It creates additional test cases to increase coverage.
  • It helps in determining a quantitative measure of code coverage, which indirectly measures the quality of the application or product.

Installation

Pip install coverage

Use "coverage run" to run your program and gather data:

coverage run manage.py test

coverage report -m  # provides the report for the tests

Individual app test can be run using the command

coverage run --source=app1,app2 manage.py test

Posted On 13 February 2016 By MicroPyramid


Need any Help in your Project?Let's Talk

Latest Comments
How do I profile django application using django web profiler

When working with a large scale applications which includes many modules, we need to focus on the performance to give more user statisfaction, sustainability. To …

Continue Reading...
Multifactor Authentication with Django MFA using Google Authenticator

Use Django Multi-Factor Authentication method to verify user identity with more than one authentication methods. It can be used for user login, any transactional methods …

Continue Reading...
Celery Flower to monitor task queue

Celery is a task queue that is to built an asynchronous message passing system. It can be used as a bucket where programming tasks can …

Continue Reading...
Check test coverage in Django code with Coveralls

Coverage: It is a tool used for measuring the effectiveness of tests, showing the percentage of your codebase covered by tests.
Test Coverage is an important …

Continue Reading...
Full text search in mongodb

Full text search is a custom implementation created by the MongoDB developers as a specific index type

Full text search as an index type when …

Continue Reading...
MongoDB CRUD operations with Python (Pymongo)

MongoDB with Python - Connection establishment, Create, Update, Retrieve and Delete operations explained with sample code.

Continue Reading...
Advanced Querying in MongoDB

Advanced Queries of MongoDB: Inserting records to the database and retrieving data from database.
1. Wrapped Queries: Like, sort, limit, count.
2. Query Using Modifiers: set, increment, …

Continue Reading...
MONGODB GROUP() VS MAPREDUCE VS AGGREGATION Framework

The group() command, Aggregation Framework and MapReduce are collectively aggregation features of MongoDB. group(): Group Performs simple aggregation operations on a collection documents. Group is …

Continue Reading...

Subscribe To our news letter

Subscribe and Stay Updated about our Webinars, news and articles on Django, Python, Machine Learning, Amazon Web Services, DevOps, Salesforce, ReactJS, AngularJS, React Native.
* We don't provide your email contact details to any third parties