Testing Learner Solutions
Assessment tests are for determining whether the learner got the correct answer. When you write tests, think about the types of common errors that a learner often makes, and include tests for these conditions. The following examples illustrate some of the more common conditions to consider in writing assessments. The examples include suggestions for the messages to provide to learners as output after the tests run.
Example problems from MathWorks® staff are provided to help you write problems and assessments. These example problems illustrate good practices for authoring problems and creating assessments to test the accuracy of leaner submissions.
For all tests:
You can set the assessment method to Correct/Incorrect or Weighted. The assessment method determines how the points assigned to the problem are awarded.
You can indicate that a test is a pre-test.
Test types can be among these options:
Compare to ref solution (script problems only; for function problems, use the assessment function
Whether a function or keyword is present
Whether a function or keyword is absent
Write out the assessment using MATLAB® code
You can convert any of these options (except for MATLAB code) to MATLAB code.
See Write Assessments for Function-Based Learner Solutions and Write Assessments for Script-Based Learner Solutions for details on these types.
If you select the Correct/Incorrect method, the problem is treated as pass/fail. Assessments defined as Correct/Incorrect return 1 if all tests pass and 0 if any tests fail. If all assessments are correct, the maximum point possible are awarded. If any assessment tests are marked incorrect, no points are awarded.
If you select the Weighted method, it is possible to award partial credit. You assign each assessment test a percentage of the total points possible. You can modify the percentage by changing the point value (weight) assigned to each assessment. The points awarded are determined by summing the percentages of the assessments marked correct and multiplying by the maximum points possible.
For example, consider a problem with two assessment tests. You want 1/3 of the points (33%) to be awarded for getting the first assessment correct and 2/3 (67%) for getting the second one correct. When creating the assessments, you would assign one point to the first test and two points to the second test.
The following images demonstrate what the learner sees when the assessment is weighted.
Before submitting a solution:
After submitting a solution that passes the assessment:
After submitting a solution that does not pass the assessment:
To indicate assessments are weighted, select
Weighted as the Assessment
When you create multiple assessments, you assign the weight each assessment should have by assigning points:
You can show the percentage to learners:
Show Customized Feedback
You can provide additional customized feedback to the learner on test failure. This feedback can be written using rich text format, including formatted text, hypertext links, images, and math equations.
Show Feedback for Initial Error Only (Script-Based Problems)
In a script-based problem, an initial error may cause subsequent errors. You may want to encourage the learner to focus first on the initial error.
When you select the option Only Show Feedback for Initial Error, detailed feedback is shown for the initial error, but is hidden by default for subsequent errors. The learner can display this additional feedback by clicking Show Feedback.