There are a few tips and tricks that will help you make test cases faster and more efficiently. See below for help on certain types of test cases.

Automatically Generate Output

You can automatically generate the output for each IO test case that you create. Simply set up a project, and go to the test cases page. Create a new IO test case, complete the required fields, and make sure you have "Automatically Generate Output" switched on. 

When you save/create that test case, it will take your input, run it against the perfect code you have uploaded, and store the correct output.

IMPORTANT!

The toggle options at the bottom of the test case dialog box are very influential on the operation of your test case. If you toggle on any of the 'Show' options, your test case input is at risk of extraction when students run their code. For this reason, we encourage instructors to make multiple test cases, some completely hidden (meaning all 'Show' options are toggled off), and some that give feedback to students.

There are additional options for test case visibility. These options are used to have tests evaluate the students work and prevent them from coding to the test case.

Python Unit Tests

Python unit tests must contain an assert line. This is the line that actually tests the program.

Python

# use this
this = 1
that = 1
assert this is that
# or this
assert this == that

Java Unit Tests

Java unit tests must only have 1 return line in them - see below.

Java

// do this
this = 1;
that = 1;
if (this == that){
  return true;
}

Using expressions in the return statement can cause errors so avoid writing a test case like this:

Java

// avoid this
this = 1;
that = 1;
return (this == that);
Did this answer your question?