Commit 56d17d8a by Jay Zoldak

Improve some comments and names in the acceptance test framework

parent d5111b9e
...@@ -3,34 +3,13 @@ ...@@ -3,34 +3,13 @@
This fake django app is here to support acceptance testing using <a href="http://lettuce.it/">lettuce</a> + 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>). <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. First you need to make sure that you've installed the requirements.
This includes lettuce, selenium, splinter, etc. This includes lettuce, selenium, splinter, etc.
Do this with: Do this with:
```pip install -r test-requirements.txt``` ```pip install -r test-requirements.txt```
First set up the database that you need: The settings.py environment file used is named acceptance.py.
WARNING!!! THIS WILL OVERWRITE THE DATA IN YOUR DEV DATABASE It uses a test SQLite database defined as ../db/test-mitx.db.
IF YOU WANT TO KEEP THAT DATA, SAVE A COPY OF YOUR ../db/mitx.db ELSEWHERE FIRST! You need to first start up the server separately, then run the lettuce scenarios.
<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```
Or you can use the rake task named lettuce like this: 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>.
rake lettuce[lms/djangoapps/portal/features/homepage.feature]
# Use this as your terrain file so that the common steps # Use this as your lettuce terrain file so that the common steps
# across all lms apps can be put in terrain/steps # across all lms apps can be put in terrain/common
# See https://groups.google.com/forum/?fromgroups=#!msg/lettuce-users/5VyU9B4HcX8/USgbGIJdS5QJ # See https://groups.google.com/forum/?fromgroups=#!msg/lettuce-users/5VyU9B4HcX8/USgbGIJdS5QJ
from terrain.browser import * from terrain.browser import *
from terrain.common import * from terrain.steps import *
from terrain.factories import * from terrain.factories import *
\ No newline at end of file
...@@ -4,25 +4,20 @@ from logging import getLogger ...@@ -4,25 +4,20 @@ from logging import getLogger
import time import time
logger = getLogger(__name__) 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 from django.core.management import call_command
@before.harvest @before.harvest
def initial_setup(server): 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 # Launch firefox
world.browser = Browser('firefox') world.browser = Browser('firefox')
@before.each_scenario @before.each_scenario
def reset_data(scenario): def reset_data(scenario):
# Clean up the django database # Clean out the django test database defined in the
logger.info("Flushing the test database...") # envs/acceptance.py file: mitx_all/db/test_mitx.db
logger.debug("Flushing the test database...")
call_command('flush', interactive=False) call_command('flush', interactive=False)
@after.all @after.all
......
...@@ -8,10 +8,18 @@ from .test import * ...@@ -8,10 +8,18 @@ from .test import *
# otherwise the browser will not render the pages correctly # otherwise the browser will not render the pages correctly
DEBUG = True DEBUG = True
# We need to apply the SOUTH migrations to set up the # Show the courses that are in the data directory
# auth tables correctly. Otherwise you'll get an error like this: COURSES_ROOT = ENV_ROOT / "data"
# DatabaseError: no such table: auth_registration DATA_DIR = COURSES_ROOT
SOUTH_TESTS_MIGRATE = True 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 # Set this up so that rake lms[acceptance] and running the
# harvest command both use the same (test) database # harvest command both use the same (test) database
...@@ -24,6 +32,10 @@ DATABASES = { ...@@ -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',) INSTALLED_APPS += ('lettuce.django',)
LETTUCE_APPS = ('portal',) # dummy app covers the home page, login, registration, and course enrollment LETTUCE_APPS = ('portal',) # dummy app covers the home page, login, registration, and course enrollment
...@@ -76,6 +76,8 @@ MITX_FEATURES = { ...@@ -76,6 +76,8 @@ MITX_FEATURES = {
'DISABLE_LOGIN_BUTTON': False, # used in systems where login is automatic, eg MIT SSL '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 # extrernal access methods
'ACCESS_REQUIRE_STAFF_FOR_COURSE': False, 'ACCESS_REQUIRE_STAFF_FOR_COURSE': False,
'AUTH_USE_OPENID': False, 'AUTH_USE_OPENID': False,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<h2> ${display_name} </h2> <h2> ${display_name} </h2>
% endif % endif
%if settings.MITX_FEATURES['DISPLAY_TOY_COURSES']: %if settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']:
<div id="stub_out_video_for_testing"></div> <div id="stub_out_video_for_testing"></div>
%else: %else:
<div id="video_${id}" class="video" data-streams="${streams}" data-caption-data-dir="${data_dir}" data-show-captions="${show_captions}"> <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