Skip to content

Commit

Permalink
Merge pull request #127 from gitaarik/update-testing-documentation
Browse files Browse the repository at this point in the history
Update testing documentation
  • Loading branch information
jrief committed Dec 2, 2015
2 parents b4edf7c + b789a15 commit de36f0c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 28 deletions.
36 changes: 20 additions & 16 deletions docs/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,24 @@ the SQLite database
# activate virtualenv
source /path/to/virtualenv/bin/activate
# pip
pip install /django-websocket/redis/examples/chatserver/requirements.txt
# Make sure you're in the examples/ directory
cd examples/
# install pip requirements
pip install -r requirements.txt
# Django 1.7+
# Load test data
./manage.py loaddata chatserver/fixtures/data.json # if needed
./manage.py makemigrations
./manage.py migrate
./manage.py loaddata chatserver/fixtures/data.json
and then start the server

.. code-block:: bash
# start Redis Server
# start Redis Server from a different shell prompt
# (or follow quickstart instructions http://redis.io/topics/quickstart)
redis-server
# start Django
./manage.py runserver
Expand Down Expand Up @@ -61,17 +64,10 @@ Both chat server tests from above should run in this configuration.

Running Unit Tests
==================
To run the unit tests, a few additional packages have to be installed

.. code-block:: bash
pip install -r examples/chatserver/tests/requirements.txt
Run the tests

.. code-block:: bash
cd examples && ./manage.py test chatserver --settings=chatserver.tests.settings
./manage.py test chatserver --settings=chatserver.tests.settings
Currently it is not possible to simulate more than one client at a time. Django's built in
LiveServerTestCase_ can not handle more than one simultaneous open connection, and thus more
Expand All @@ -83,13 +79,21 @@ Running Stress Tests
To run stress tests, change into directory ``stress-tests``. Since stress tests shall check the
performance in a real environment, the server and the testing client must be started independently.

First start the server, as you would in productive environments
First start the server, as you would in productive environments.

.. code-block:: bash
uwsgi --virtualenv /path/to/virtualenvs --http :8000 --gevent 1000 --http-websockets --master --workers 2 --module wsgi_websocket
# Open a new shell and activate your virtualenv in it
source /path/to/virtualenv/bin/activate
# Install the uwsgi package
pip install uwsgi
# Then start the uwsgi server
uwsgi --http :8000 --gevent 1000 --http-websockets --master --workers 2 --module wsgi_websocket
then start one of the testing clients, using the nose_ framework
then go back to the other shell (also with the virtualenv activated) and start one of the testing
clients, using the nose_ framework

.. code-block:: bash
Expand Down
12 changes: 0 additions & 12 deletions examples/chatserver/tests/requirements.txt

This file was deleted.

0 comments on commit de36f0c

Please sign in to comment.