Adding Test Cases

Creighton Foulkes  •  February 23, 2018  •  Test cases

What's a test case?

A test case is an input and output used to verify the correctness and optimality of a candidate's solution. Each test cases's input is passed into the solution to a given programming problem. We then determine whether the result of the solution matches the expected output.

Adding a test case

While building a new programming question, the third tab is where you can add test cases. By pressing the "Add test case" button, you can input the name of the test case, its difficulty level, the input arguments as a valid JSON array and the output also as valid JSON.

For example, given the function signature above, a valid input and output for this program would be an array of 1,2,3,4 and output 4.

Bulk upload

If your account has bulk test case uploading enabled, you can create a zip file with test case inputs and outputs. Each input file should be a JSON array, with each element corresponding to an argument in the function. Each output file should contain the corresponding expected output for that test case as valid JSON.

Here we have provided an example file directory for what your test cases might look like. The input input0 corresponds to the output output0, again for the example function signature above.

That's all there is to it! As always, feel free to send us an email at with any questions you might have about test cases.