Django application that records and replays web requests.
OTHER License
Django Replay <http://www.grantjenks.com/docs/django-replay/>
__ is an Apache2
licensed Django application that records and replays web requests.
.. image:: https://github.com/grantjenks/django-replay/workflows/integration/badge.svg :target: https://github.com/grantjenks/django-replay/actions?query=workflow%3Aintegration
.. image:: https://github.com/grantjenks/django-replay/workflows/release/badge.svg :target: https://github.com/grantjenks/django-replay/actions?query=workflow%3Arelease
Installing Django Replay is simple with pip <http://www.pip-installer.org/>
_::
$ pip install django-replay
Add replay
to the INSTALLED_APPS
in settings.py
like:
.. code::
INSTALLED_APPS += ['replay']
Then migrate the database like:
.. code::
$ python manage.py migrate
Django Replay provides two management commands:
replayrecord -- like "runserver" but request/responses are recorded.
replaytest -- runs the scenarios with actions and validators.
Django Replay also provides three models:
Scenario -- ordered list of actions.
Action -- recorded request/response template.
Validator -- regular expression for response validation.
These models can be edited in the admin.
To get started, follow the Quickstart and then record some actions:
.. code::
$ python manage.py replayrecord
Navigate to http://127.0.0.1:8000/ and use the web app as normal. Once the actions are recorded run CTRL-C to stop the command.
Now create some scenarios in the admin:
.. code::
$ python manage.py runserver
TODO: Insert screenshots of creating scenarios.
The scenarios can be tested manually using:
.. code::
$ python manage.py replaytest
Remember to clear the content of the actions. Now the tests can be saved in a fixture.
.. code::
$ python manage.py dumpdata --indent 4 replay > replay.json
And the scenarios can be integrated with Django's test framework like so:
.. code::
from django.test import TestCase from replay.utils import test_scenarios
class ReplayTestCase(TestCase):
fixtures = ['path/to/replay.json']
def test_scenarios(self):
test_scenarios()
Templates and Validators ........................
TODO: Describe templating syntax for requests
TODO: Describe regular expression features for validators
Django Replay Documentation
_Django Replay at PyPI
_Django Replay at GitHub
_Django Replay Issue Tracker
_.. _Django Replay Documentation
: http://www.grantjenks.com/docs/django-replay/
.. _Django Replay at PyPI
: https://pypi.python.org/pypi/django-replay/
.. _Django Replay at GitHub
: https://github.com/grantjenks/django-replay
.. _Django Replay Issue Tracker
: https://github.com/grantjenks/django-replay/issues
Copyright 2017-2022 Grant Jenks
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.