Show
Automated testings
All new features classes have their own test:
PHPUnitTests: vendor/bin/phpunit -c mod/h5pactivity https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/773/
Behat: execute behat with --tags=@mod_h5pactivity https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/5238/
Manual Testing
In the near future, this plugin will provide a report to list attempts and tracking information. For now the test requires to look at the DB to check the tracking information.
Setup test:
Check in your DB that your h5pactivity_attemps and h5pactivity_attempts_results are empty.
SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts -> check that returns 0
SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts_results -> check that returns 0
If they are not empty delete all content (should not happen but if it's the second time you test this issue could be)
SQL: DELETE FROM mdl_h5pactivity_attempts
SQL: DELETE FROM mdl_h5pactivity_attempts_results
Manual test (student tracking):
Create a course with a H5P activity on it with the H5P attached in this issue ( question-set-616.h5p ).
Enrol a student and access to the activity as this student
Complete one attempt (3 questions, doesn't matter if you pass or fail)
Remember your result and click on "Retry"
Repeat the attempt and remember the new result also (if possible, change some answer to generate different results)
Once both attempts are done login as admin in the course and go "course administration -> reports -> logs" and show all today logs from the student.
Check that 1 "H5P content viewed" and 8 xAPI statement received log entries appears.
Now go to the DB select all rows from h5pactivity_attempts and:
SQL: SELECT * FROM mdl_h5pactivity_attempts
Check 2 attempts have been created with the student "userid"
Check that the "rawscore" corresponds to both results you obtained.
Now select all rows from h5pactivity_attempts_results and:
SQL: SELECT * FROM mdl_h5pactivity_attempts_results
Check that there are 4 rows with one attemptid and 4 with another (corresponding with the ids from h5pactivity_attempts)
Check that on the rows from one attemptid the "interactiontype" are: 1 compound, 2 choice, 1 matching
Check that only the rows with "compound" interactiontype have an empty "response" and "correctpattern".
Go to the course and go to "course administration -> reset course"
Check that in the form appears a header called "H5P activities" and inside it, there's an unchecked element called "Delete all H5P attempts"
Click on "Select default" at the end of the form.
Check that "Delete all H5P attempts" is now checked
Uncheck "Delete all H5P attempts" and click on "reset course" button
Check that no errors appear
Check that h5pactivity_attemps and h5pactivity_attemps_results still have all the attempts
SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts -> check that returns 2
SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts_results -> check that returns 8
Go to the course and go to "course administration -> reset course"
Click on "Select default" at the end of the form.
Now click on "reset course"
Check that no errors or warning appears and "Delete all H5P attempts" displays an OK.
Check that both h5pactivity_attemps and h5pactivity_attempts_results are empty in the DB
SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts -> check that returns 0
SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts_results -> check that returns 0
Manual test (admin no tracking, continuing from the previous test):
Using the same scenario as before, login as admin and access the activity
Check that a warning appears with the text "This content is displayed in preview mode. No attempt tracking will be stored."
Answer all the questions and finish the activity
Check that no new entries are created in h5pactivity_attemps and h5pactivity_attemps_results
SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts -> check that returns 0
SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts_results -> check that returns 0
Testing more H5P contents
This test will check that other H5P contents track as expected. For every file the process is the same:
Remove all entries from attempts tables:
SQL: DELETE FROM mdl_h5pactivity_attempts
SQL: DELETE FROM mdl_h5pactivity_attempts_results
Create an activity with the H5P package
Login as student and finish the activity once (do not click on retry, we just wants to check one attempt now)
Check on the DB that the information stored is similar than the one provided below this explanation
SQL: SELECT * FROM mdl_h5pactivity_attempts -> check that one attempt is created.
SQL: SELECT * FROM mdl_h5pactivity_attempts_results -> check the values specified on the next list
List of files to check:
Arithmetic quiz (file to use arithmetic-quiz.h5p ) checks :
interactiontype: other
description: (empty)
correctpattern: (empty)
response: (empty)
additionals (XXX is any value):
{"extensions": {"http:\/\/h5p.org\/x-api\/h5p-local-content-id":XXX}
,"contextExtensions":{}}
rawscore: (your score)
maxscore: 5
Multiple choice (file to use multiple-choice-713.h5p ) checks :
interactiontype: choice
description: What color does the blackcurrant berry actually have?
correctpattern(XXX is any value): ["XXX"]
response: (an integer from 0 to 3)
additionals (XXX is any value):
{"choices":\\\{"id":"0","description":{"en-US":"Very dark purple\n"}},\\\\{"id":"1","description":{"en-US":"Blue\n"}},\\\\{"id":"2","description":{"en-US":"Black\n"}},"extensions":{"http:\/\/h5p.org\/x-api\/h5p-local-content-id":16},"contextExtensions":{}}
rawscore: (your score)
maxscore: 1
Interactive video (file interactive-video-2-618.h5p ) checks :
check that 6 h5pactivity_attemps_results are created
check interactiontypes: compound, choice, fill-in, matching, choice, compound
check only one "compound" entry have an empty "subcontent"
check only "compound" entries have empty "correctpattern" and "response"
check all anties have values in additionals, rawscore and maxscore
Fill the blanks (file fill-in-the-blanks-837.h5p )
interactiontype: fill-in
description: <p>Insert the missing words in this text about berries found in Norwegian... (text continues)
correctpattern(XXX is any value):
[ "{case_matters=false}blue[,]Cloud[,]black" ]
response: (your respondes separated with " [,] ")
additionals (XXX is any value):
{"extensions":{"http:\/\/h5p.org\/x-api\/h5p-local-content-id":XXX,"https:\/\/h5p.org\/x-api\/case-sensitivity":false,"https:\/\/h5p.org\/x-api\/alternatives":[["blue"],["Cloud"],["black"]]},"contextExtensions":{"https:\/\/h5p.org\/x-api\/h5p-reporting-version":"1.1.0"}}
rawscore: (your score)
maxscore: 3