Issue Details (XML | Word | Printable)

Key: MDL-17295
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Tim Hunt
Reporter: Tim Hunt
Votes: 0
Watchers: 1
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle
MDL-17284

Write unit tests for quiz_questions_in_quiz, quiz_number_of_pages and quiz_number_of_questions_in_quiz

Created: 19/Nov/08 03:48 PM   Updated: 24/Nov/08 07:07 PM
Return to search
Component/s: Quiz
Affects Version/s: 2.0
Fix Version/s: 2.0

Participants: Olli Savolainen and Tim Hunt
Security Level: None
Resolved date: 23/Nov/08
Affected Branches: MOODLE_20_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
These functions have become much trickier. However, they look like they should be really easy to unit test.

You can start by copying mod/quiz/simpletest/testlib.php to mod/quiz/simpletest/testlocallib.php then edit. The docs are at http://docs.moodle.org/en/Development:Unit_tests. You will probably need to use assertEquals.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Olli Savolainen added a comment - 23/Nov/08 03:15 AM
Sorry, but I feel I need to draw a line here. I really do not think this is what I should be focusing on. I understand that it is my code that needs to be tested with those test cases; still this is not part of the core work itself.

I probably could learn to write those test cases with a moderate amount of work, but I am really running out of time.

Most importantly though, I really hope to focus exclusively on usability work and not on the programming, and this is rather far from that goal - it won't serve any greater purpose to focus on learning that right now.


Tim Hunt added a comment - 23/Nov/08 07:05 PM
Fair enough - but I don't feel apologetic for trying to encourage more people to write test cases.

Tim Hunt added a comment - 23/Nov/08 09:48 PM
And my instincts were right. There were some edge-cases where these functions were giving the wrong results.

If you have a moment, you might like to have a quick look at mod/quiz/simpletest/testlocallib.php, and then go to .../admin/report/unittest/index.php?path=mod%2Fquiz in your test Moodle site to get get an idea what is involved.


Olli Savolainen added a comment - 24/Nov/08 07:07 PM
Thank you Tim. Agreed, it is a worthy goal per se. Will take a look ASAP.