Skip to main content

Remote scenario setup for e2e testing of django projects

Project description

Remote scenario setup for e2e testing of django projects


The full documentation will be at


Install django-remote-scenario:

pip install django-remote-scenario

Then add it to an existing django project:


Inside your settings file you also need to add the following:


You need to add django_rs urls to your project url file like this:

urlpatterns = patterns('',
url(r'^drs/', include('django_rs.urls')),

To create custom scenarios, just create a directory inside your app named “scenarios” , then add as many files as scenarios you want to implement and create a so it becomes a module . Inside each of those files, you need to implement a main() function setting up the models you want to create for the scenario, you could create them by hand or use something like django_dynamic_fixtures

Once everything is ready, start the server this way, this will enable the dynamic call of scenarios:

python rune2eserver initial_data.json

Note: You need to pass a initial fixture file with the barebones of your data.

it is also possible (but not mandatory) to pass a specific settings file, for testing purposes, in case you want to do the tests using a different database for example:

python rune2eserver initial_data.json --settings=demoproject.test_settings [fixture1 fixture2....] [--addrport ipaddress:port]

You might also use you existing database to load scenarios on top of it with the “–skip-test-db” or “-t” modifier:

python rune2eserver -t initial_data.json

To start using it, just go to the following url:[APPLICATION]/[SCENARIO]

after doing that the database will be populated with the data you provided in your scenario. Take into account that, everytime you call an scenario, all the other data in the database is erased, except for the one in your initial_data fixture files, wich are loaded again, and also the one you pass as a parameter when you call the command.

Inside this repository you will find a demo Django project preconfigured with a simple scenario that sets up four objects. Use it like this:

First run the server:

$ python rune2eserver initial_data.json --settings=demoproject.test_settings

Then go to your browser and setup a scenario:

You may also pass a parameter to avoid flushing the database on a specific call:

Later you could see the results on the following url:


It is possible to mock parts of your backend between scenarios calls. You need to add a new directory inside the scenarios directory and name ir ‘mocks’, then, again, add as many mocks as you want to implement and create a so it becomes a module . Inside each of those files. You can apply as many mocks as you want and deactivate them selectibly. Pay special atention to the order this mocks are applied, as it may affect their internal behaviour.

To apply a mock just go to the following URL (assumming a file named mock_1 inside demoapp/mocks

To remove the mock:

An example of a mock can be found inside the test application

Browseable interface

Experimental scenario and mocking browseable interface could be used to apply mocks and load scenarios by visting the root url for drs (on this case /drs/)


  • TODO


0.1.0 (2014-05-31)

  • First release on PyPI.

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-remote-scenario-0.3.1.tar.gz (72.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page