Quade: The Friendly QA App¶
Quade is a Django app that makes quality assurance testing easier. It handles the burden of repeatedly setting up the same data, and helps you track the progress of your tests.
Dive in with our Quickstart!
Quickstart¶
- Follow the installation guide:
Install Quade with pip:
pip install quadeAdd Quade to your project’s
INSTALLED_APPS
:INSTALLED_APPS = [ ... 'quade.apps.QuadeConfig', ]Initialize the Quade settings by adding these lines to your Django settings:
import quade QUADE = quade.Settings()(By default, Quade will only be available whenDEBUG=True
. For more details, see Settings.)
Add the django_jinja template handler to your
TEMPLATES
setting, while retaining any other template handlers you have. For example:TEMPLATES = [ # Existing code, leave in-place { 'BACKEND': 'django.template.backends.django.DjangoTemplates', ... }, # New code to add { 'BACKEND': 'django_jinja.backend.Jinja2', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'app_dirname': 'jinja2', }, }, ]Add Quade to your URL configuration, e.g.:
# urls.py urlpatterns = [ ... url(r'^quade/', include('quade.urls')) ]Run migrations:
python manage.py migrate quade
Create a fixtures file,
fixtures.py
, in the root of your project:# fixtures.py import uuid from django.contrib.auth import get_user_model from quade.managers import register User = get_user_model() @register def user(): new_user = User.objects.create( first_name='Alyssa', last_name='Hacker', username='alyssa-{}'.format(uuid.uuid4()) ) return "User #{}".format(new_user.pk)
Update your settings to make Quade aware of your fixtures file:
QUADE = quade.settings(fixtures_file='fixtures')
Enter the Django shell and create a
Scenario
that uses this fixture:from quade.models import Scenario Scenario.objects.create( config=[('user', {})], description='Single User', slug='single-user', status=Scenario.Status.ACTIVE )
Start your project’s webserver and visit the main Quade page. You will be able to generate new users on demand by selecting the “Single User” scenario and executing it.
Begin creating your own fixtures and
Scenarios
!
Installation¶
Install Quade with pip:
pip install quade
Add Quade to your project’s
INSTALLED_APPS
:INSTALLED_APPS = [ ... 'quade.apps.QuadeConfig', ]
Initialize the Quade settings by adding these lines to your Django settings:
import quade QUADE = quade.Settings()
(By default, Quade will only be available whenDEBUG=True
. For more details, see Settings.)
Add the django_jinja template handler to your
TEMPLATES
setting, while retaining any other template handlers you have. For example:TEMPLATES = [ # Existing code, leave in-place { 'BACKEND': 'django.template.backends.django.DjangoTemplates', ... }, # New code to add { 'BACKEND': 'django_jinja.backend.Jinja2', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'app_dirname': 'jinja2', }, }, ]
Add Quade to your URL configuration, e.g.:
# urls.py urlpatterns = [ ... url(r'^quade/', include('quade.urls')) ]
Run migrations:
python manage.py migrate quade
You’re ready to roll!
Models¶
-
class
quade.models.
Scenario
(*args, **kwargs)[source]¶ A specific scenario that QA tests will be run against.
The heart of a
Scenario
is the config attribute. config is a list of several fixtures, possibly with arguments, which are executed sequentially to create and modify objects in the database.
Settings¶
Quade includes a Settings class that encapsulates various configuration options.
Available Settings¶
-
class
quade.
Settings
(**kwargs)[source]¶ -
access_test_func
¶ A callable that restricts access to Quade’s views. The callable should accept one argument (a Django view class).
Default:
is_superuser()
-
allowed_envs
¶ Controls which environments Quade can run on.
Allowed values are:
DebugEnvs
AllEnvs
- a string – your
django.conf.settings.ENV
is compared exactly to this string - an iterable – your
django.conf.settings.ENV
is checked exactly for membership in the iterable - any callable that accepts one argument, the Django settings object
If Quade is not enabled, fixtures will not be loaded, but views will be available to users with appropriate access, application models and tables can be accessed, etc.
Default:
DebugEnvs
-
fixtures_file
¶ A dotted path to the location of your fixtures.
Default:
quade.fixtures
-
use_celery
¶ Whether to use Celery to set up a Record.
Enabling this is useful if your fixtures take a long time to run.
See Using Celery for additional details.
Default:
False
-
Using Celery¶
By default, Quade will execute Records
synchronously.
If you wish to execute them asynchronously instead,
Quade ships with a Celery task for this purpose.
To enable it, specify use_celery=True in your Quade setting.
You must also ensure that Celery is installed and properly configured. You can install Celery as a dependency of Quade by specifying the celery extra during installation:
pip install quade[celery]