Skip to content
Snippets Groups Projects
Commit 256a93f1 authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Make adding the default testcase easier with a button.

parent 6faf6712
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,10 @@ How to report bugs and make suggestions is described on the [community](../About
## Version 4.4.3
Done.
1. Rename testing page as "STACK question dashboard" and make it much easier to add a test case based on the teacher's answer.
TODO: track down bug in assignments/evaluation affecting the inputs.
TODO: List of long lasting issues dealt with, that might need to be notified/closed, note that some of these have connecting issues:
......
......@@ -542,7 +542,8 @@ $string['questiontestsdefault'] = '(Default)';
$string['runquestiontests'] = 'STACK question dashboard';
$string['runquestiontests_help'] = 'The dashboard runs question tests which unit-test the questions to ensure the behaviour matches expectations expressed by the teacher, and deployed variants ensure random versions seen by a student are pre-tested against the question tests. These are tools to help you create and test reliable questions and should be used in all cases a question will be used by students. The dashboard also has numerous other STACK specific functions.';
$string['runquestiontests_alert'] = 'Question is missing tests or variants.';
$string['runquestiontests_auto'] = 'Automatically adding one test case assuming the teacher\'s input values get full marks. Please check the answer note carefully.';
$string['runquestiontests_auto'] = 'Automatically adding one test case assuming the teacher\'s input gets full marks. Please check the answer note carefully.';
$string['runquestiontests_autoprompt'] = 'Add test case assuming the teacher\'s input gets full marks.';
$string['showingundeployedvariant'] = 'Showing undeployed variant: {$a}';
$string['switchtovariant'] = 'Switch to variant: ';
$string['testcasexresult'] = 'Test case {$a->no} {$a->result}';
......
......@@ -188,8 +188,8 @@ $questionvariablevalues = $question->get_question_session_keyval_representation(
// Load the list of test cases.
$testscases = question_bank::get_qtype('stack')->load_question_tests($question->id);
if (empty($testscases) && $canedit) {
// Add in a default test case and give it full marks.
// Create the default test case.
if (optional_param('defaulttestcase', null, PARAM_INT) && $canedit) {
$inputs = array();
foreach ($question->inputs as $inputname => $input) {
$inputs[$inputname] = $input->get_teacher_answer_testcase();
......@@ -212,8 +212,18 @@ if (empty($testscases) && $canedit) {
question_bank::get_qtype('stack')->save_question_test($questionid, $qtest);
$testscases = question_bank::get_qtype('stack')->load_question_tests($question->id);
echo html_writer::tag('p', stack_string_error('runquestiontests_alert') . ' ' .
stack_string('runquestiontests_auto'));
echo html_writer::tag('p', stack_string_error('runquestiontests_auto'));
}
// Prompt user to create the default test case.
if (empty($testscases) && $canedit) {
// Add in a default test case and give it full marks.
echo html_writer::start_tag('form', array('method' => 'get', 'class' => 'defaulttestcase',
'action' => new moodle_url('/question/type/stack/questiontestrun.php', $urlparams)));
echo html_writer::input_hidden_params(new moodle_url($PAGE->url,
array('sesskey' => sesskey(), 'defaulttestcase' => 1)));
echo ' ' . html_writer::empty_tag('input', array('type' => 'submit', 'class' => 'btn btn-danger',
'value' => stack_string('runquestiontests_autoprompt')));
echo html_writer::end_tag('form');
}
$deployfeedback = optional_param('deployfeedback', null, PARAM_TEXT);
......
......@@ -54,9 +54,15 @@ Feature: Create, preview, test, tidy and edit STACK questions
And I should see "Mark 0.90 out of 1.00"
And I should see "Marks for this submission: 1.00/1.00. Accounting for previous tries, this gives 0.90/1.00."
# Create a question test.
# Create a question test: two methods.
When I follow "Question is missing tests or variants"
Then I should see "This question does not use randomisation."
When I press "Add test case assuming the teacher's input gets full marks."
Then I should see "Automatically adding one test case assuming the teacher's input gets full marks. Please check the answer note carefully."
When I press "Delete this testcase."
Then I should see "Are you sure you want to delete test case 1 for question Test STACK question"
When I press "Continue"
Then I should see "Question is missing tests or variants. No test cases have been added yet."
When I press "Add a test case..."
And I set the following fields to these values:
| ans1 | x - 1 |
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment