Commit 56d17d8a by Jay Zoldak

Improve some comments and names in the acceptance test framework

parent d5111b9e
......@@ -3,34 +3,13 @@
This fake django app is here to support acceptance testing using <a href="http://lettuce.it/">lettuce</a> +
<a href="http://splinter.cobrateam.info/">splinter</a> (which wraps <a href="http://selenium.googlecode.com/svn/trunk/docs/api/py/index.html">selenium</a>).
Some documentation for our efforts are located in basecamp at <a href="https://basecamp.com/1892446/projects/841513-release/documents/1015202-staging-tests">this link</a>.
First you need to make sure that you've installed the requirements.
This includes lettuce, selenium, splinter, etc.
Do this with:
```pip install -r test-requirements.txt```
First set up the database that you need:
WARNING!!! THIS WILL OVERWRITE THE DATA IN YOUR DEV DATABASE
IF YOU WANT TO KEEP THAT DATA, SAVE A COPY OF YOUR ../db/mitx.db ELSEWHERE FIRST!
<li>If necessary, delete it first from mit_all/db</li>
<li>```rake django-admin[syncdb,lms,acceptance]```</li>
<li>```rake django-admin[migrate,lms,acceptance]```</li>
To use, start up the server separately:
```rake lms[acceptance]```
In between scenarios, flush the database with this command.
You will not need to do this if it's set up in the terrain.py file
which is at the mitx root level.
```rake django-admin[flush,lms,acceptance,--noinput]```
Running the all the user acceptance scenarios:
```django-admin.py harvest --no-server --settings=lms.envs.acceptance --pythonpath=.```
Running a single user acceptance scenario:
```django-admin.py harvest --no-server --settings=lms.envs.acceptance --pythonpath=. lms/djangoapps/portal/features/signup.feature```
The settings.py environment file used is named acceptance.py.
It uses a test SQLite database defined as ../db/test-mitx.db.
You need to first start up the server separately, then run the lettuce scenarios.
Or you can use the rake task named lettuce like this:
rake lettuce[lms/djangoapps/portal/features/homepage.feature]
Full documentation can be found on the wiki at <a href="https://edx-wiki.atlassian.net/wiki/display/ENG/Lettuce+Acceptance+Testing">this link</a>.
# Use this as your terrain file so that the common steps
# across all lms apps can be put in terrain/steps
# Use this as your lettuce terrain file so that the common steps
# across all lms apps can be put in terrain/common
# See https://groups.google.com/forum/?fromgroups=#!msg/lettuce-users/5VyU9B4HcX8/USgbGIJdS5QJ
from terrain.browser import *
from terrain.common import *
from terrain.steps import *
from terrain.factories import *
\ No newline at end of file
......@@ -4,25 +4,20 @@ from logging import getLogger
import time
logger = getLogger(__name__)
logger.info("Loading the terrain file...")
logger.info("Loading the lettuce acceptance testing terrain file...")
from django.core.management import call_command
@before.harvest
def initial_setup(server):
# Sync the test database defined in the settings.py file
# then apply the SOUTH migrations
call_command('syncdb', interactive=False)
call_command('migrate', interactive=False)
# Launch firefox
world.browser = Browser('firefox')
@before.each_scenario
def reset_data(scenario):
# Clean up the django database
logger.info("Flushing the test database...")
# Clean out the django test database defined in the
# envs/acceptance.py file: mitx_all/db/test_mitx.db
logger.debug("Flushing the test database...")
call_command('flush', interactive=False)
@after.all
......
......@@ -8,10 +8,18 @@ from .test import *
# otherwise the browser will not render the pages correctly
DEBUG = True
# We need to apply the SOUTH migrations to set up the
# auth tables correctly. Otherwise you'll get an error like this:
# DatabaseError: no such table: auth_registration
SOUTH_TESTS_MIGRATE = True
# Show the courses that are in the data directory
COURSES_ROOT = ENV_ROOT / "data"
DATA_DIR = COURSES_ROOT
MODULESTORE = {
'default': {
'ENGINE': 'xmodule.modulestore.xml.XMLModuleStore',
'OPTIONS': {
'data_dir': DATA_DIR,
'default_class': 'xmodule.hidden_module.HiddenDescriptor',
}
}
}
# Set this up so that rake lms[acceptance] and running the
# harvest command both use the same (test) database
......@@ -24,6 +32,10 @@ DATABASES = {
}
}
MITX_FEATURES['DISPLAY_TOY_COURSES'] = True
# Do not display the YouTube videos in the browser while running the
# acceptance tests. This makes them faster and more reliable
MITX_FEATURES['STUB_VIDEO_FOR_TESTING'] = True
# Include the lettuce app for acceptance testing, including the 'harvest' django-admin command
INSTALLED_APPS += ('lettuce.django',)
LETTUCE_APPS = ('portal',) # dummy app covers the home page, login, registration, and course enrollment
......@@ -76,6 +76,8 @@ MITX_FEATURES = {
'DISABLE_LOGIN_BUTTON': False, # used in systems where login is automatic, eg MIT SSL
'STUB_VIDEO_FOR_TESTING': False, # do not display video when running automated acceptance tests
# extrernal access methods
'ACCESS_REQUIRE_STAFF_FOR_COURSE': False,
'AUTH_USE_OPENID': False,
......
......@@ -2,7 +2,7 @@
<h2> ${display_name} </h2>
% endif
%if settings.MITX_FEATURES['DISPLAY_TOY_COURSES']:
%if settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']:
<div id="stub_out_video_for_testing"></div>
%else:
<div id="video_${id}" class="video" data-streams="${streams}" data-caption-data-dir="${data_dir}" data-show-captions="${show_captions}">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment