Skip to main content

Smoke tests framework for Django Web Framework

Project description

[![Build Status](https://travis-ci.org/djentlemen/django-smoked.svg)](https://travis-ci.org/djentlemen/django-smoked)
[![Coverage Status](https://coveralls.io/repos/djentlemen/django-smoked/badge.svg?branch=master)](https://coveralls.io/r/djentlemen/django-smoked?branch=master)

# django-smoked

Smoke tests framework for Django Web Framework

## Motivation

> Code without tests is broken by design. - Jacob Kaplan-Moss, Django core developer

Every successful deployment of an application must be followed by series of tests to ensure that website is up and works.

Compared to unit/integration/functional/performance/etc tests which runs in an isolated environment, smoke tests are designed to check safely the production environment. These tests only check the fundemantal functionality, ex. email sending is working, app is able to connect to the database, background queue accepts task, etc.

## Idea

Create framework for **reusable** smoke tests which could be easily shared among projects.

Each test is defined by a name and an action to be taken:

```python
class DatabaseTest(SmokeTest):
name = 'Database test'
description = 'Check all database connection are valid'

def test(self):
...
```

Smoke tests are registered manually in custom module:

```python
# settings.py
SMOKE_TESTS = 'myproject.smoked'
```

```python
# myproject/smoked.py
import smoked

# Built-in test
smoked.register('smoked.DatabaseTest')

# Custom test
smoked.register('myproject.MessageQueueTest')

# ad-hoc function
def smoke_test():
...
smoked.register(smoke_test, name='Test my setup', description='...')

# ad-hoc function using decorator
@smoked.register(name='Verbose name', description='Long text')
def smoke_test():
...

# default name and description
@smoked.register
def smoke_test(): # name='smoke_test'
""" Docstring will become description """
...

```

Test runner is trigger either by management command:

```shell
./manage.py smoked
```

or an API call:

```shell
curl -d"TOKEN=VerySecretToken" http://myproject.io/_smoked/
```

## Licence

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-smoked-0.1-alpha.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

django_smoked-0.1_alpha.1-py2.py3-none-any.whl (9.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-smoked-0.1-alpha.1.tar.gz.

File metadata

File hashes

Hashes for django-smoked-0.1-alpha.1.tar.gz
Algorithm Hash digest
SHA256 3887730411c4e4ba7e24aa6f9d4c06fdb004c4177c6e325cc8b0e3cecbeafbfa
MD5 cf8f06763a4443b6e9f79ed4a1a887da
BLAKE2b-256 faf7eba6a5e54a68fae2bef42b9b3d2846c78795aa9f5801a4d0d73ffe777dfd

See more details on using hashes here.

Provenance

File details

Details for the file django_smoked-0.1_alpha.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_smoked-0.1_alpha.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7a2e2783bffea1e55a757210faa2aa04344b1a32094acbaf667083feae46de1f
MD5 cc6362ebdefb4737a41c381506f6299a
BLAKE2b-256 b82238ec93e64b3533914f85a6e11f2ae47dee58299212e999235def80b6dfe4

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page