Skip to content

Automated Test Coverage

Jonah Bossewitch edited this page Aug 8, 2013 · 1 revision

Table of Contents

Overview

Mediathread automated tests are a combination of the Selenium webdriver and the [Lettuce] behavior-driven development testing framework. The Lettuce harvest loads a django fixture as each feature is executed. The test server runs on port :8002.

Note: The sample data is reloaded for each feature. Scenarios within a given feature cannot 100% guarantee a particular data state. Create a new feature as required.

A test run takes about 15-20 minutes to complete. Go get a cup of coffee.

How to run the tests

1. Required in path: sqlite3 and Firefox.

1a. chromedriver, for Chrome testing. This executable needs to be on your shell path (not your python path).

2. Run ./bootstrap.py --full to ensure necessary lxml dependencies are built

3. time(./manage.py harvest --settings=settings_test --debug-mode --verbosity=2 --traceback)

Sample data

Courses & Users

  • Administrator - selenium / selenium
Sample Course
  • Staff - test_staff / test
    # This user just has a "staff" designation in the admin console
  • Instructor One - test_instructor / test
  • Teacher's Assistant - test_ta / test
    # This user is part of the Teacher's Assistant Permissions Group. 
  • Student One - test_student_one / test
  • Student Two - test_student_two / test
  • Student Three - test_student_three / test
Alternate Course
  • Instructor Alternate - test_instructor_alt / test
  • Student Alternate - test_student_alt / test
  • Student Three - test_student_three / test

Items

Sample Course

1. YouTube CCNMTL Mediathread video w/ 2 selections (test_instructor)

2. Flickr CCNTML Photo of Medical Center w/1 selection (test_instructor)

3. Flickr CCNMTl Photo of Frank and Maurice w/ 3 selections. (test_instructor, test_student_one, test_student_two)

Alternate Course

1. Design Research image w/2 selections (test_instructor_alt)

To recreate the sample_course.json fixture

1. Verify the test database is freshly loaded.

    rm lettuce.db
    echo 'create table test(idx integer primary key);' | sqlite3 lettuce.db
    ./manage.py syncdb --settings=settings_test --noinput
    ./manage.py migrate --settings=settings_test --noinput
    echo 'delete from django_content_type;' | sqlite3 lettuce.db
    ./manage.py loaddata mediathread_main/fixtures/sample_course.json --settings=settings_test

2. Run the server against the test database

    ./manage.py runserver --settings=settings_test

3. Make any changes needed, e.g. adding an additional asset to the test data.

4. Dump the new data

    ./manage.py dumpdata --settings=settings_test > mediathread_main/fixtures/sample_course.json

5. Check in sample_course.json

Test Coverage Outline

Italicized tests still need to be written

A. Login, Logout, Switch Course

    1. Login 
        a. Invalid password
        b. Valid password
        c. Instructor
        d. Student
    2. Logout
    3. Switch Course

B. Homepage

   0. Basic Navigation
       a. Home
       b. Instructor Dashboard
       c. View Recent Activity
       d. Add to My Collection
   1. Instructor Column
       a. Instructor
           i. ''Help open by default''
           ii. ''Assignment display''
           iii. ''Composition display''
           iv. ''Discussion display''
       b. Student
           i. ''Invisible state -- no information is available''
           ii. ''Visible state - assignment/information/discussion available''
           iii. ''Assignment navigation''
           iv. ''Composition navigation''
           v. ''Discussion navigation''
    2. Analysis Column
        a. ''Help open by default''
        b. ''Filter by alternate owner''
        c. ''Filter by All Class Members''
        d. ''Filter by tag''
        e. ''Filter by date''
    3. Composition Subcolumn
        a. Create Composition Navigation
        b. Edit Composition Navigation
        c. Delete composition w/alert interaction
        d. Delete composition privileges (cannot delete someone else's composition)
        e. ''Assignment/Response/Feedback links''
        f. Project visibility - private, instructor, public to class, public to world
    4. Collection Subcolumn
        a. View All Items
        b. Edit Item
        c. Delete Item w/alert interaction
        d. Delete Item privileges

C. Instructor Dashboard

    1. Manage Sources
        a. Add a source to the class
        b. Enable/Disable video upload 
    2. Course Settings
        a. Manage Publish Options
        b. Manage Selection Visibility
    3. Create Composition or Assignment
    4. Create Discussion
    5. Assignment Responses
    6. Class Activity
    7. ''Student Contributions''

D. Project Workspace

E. Item Workspace & access

    1. Asset access
        a. Basic access: User cannot access assets in another course
        b. Cross-course access: User of multiple classes is prompted to switch courses if needed 
        c. ''Direct url navigation post-login''
            i. ''Accessible asset navigates directly to item view''
            ii. ''Accessible annotation navigates directly to item view''
            iii. ''Non-accessible asset navigates to 404''
            iv. "Non-accessible annotation navigates to 404"

F. Discussion Workspace

    1. ''Create a discussion''
        a. ''Instructor only''
        b. ''Instructor controls title''
    2. Create a comment
        a. ''Cancel comment creation''
        b. ''Insert an item into the response''
        c. ''View the item in the open edit comment box''
        d. ''Save comment''
        e. View 
    3. ''Edit privileges (only owner)''
    4. ''Edit a comment''
        a. ''Cancel changes''
        b. ''Save changes''
        c. ''Insert asset''
        d. ''Insert annotation''
    5. ''Create a response''
        a. ''First response''
        b. ''Several responses down the line. (verify scroll position works)''
        c. ''Insert asset''
        d. ''Insert annotation''
    6. ''View comment''
        a. ''Verify asset''
        b. ''Verify annotation''

G. Recent Activity

H. Add To My Collection

I. Misc - Help/About/Contact