JSON object for displaying unit test output
Run tests using any unit testing framework of your choice and output the results in a structure unit test format.
We now have an easier way of parsing unit test output from frameworks that aren't supported at the Gold or Silver level. Read more about that here:
When creating a unit test via the Custom Test block, you need to write the output of the test to a JSON object so that the Custom Test block generates the output in this structured way.
How to render custom unit tests:
Create a grading script that runs your unit tests and writes the output to a separate file.
Using a grading script or by coding directly in the editor of your test block, parse the test output file into the following categories:
Organize these into a JSON object and write the object to the
3
file. Here is code snippet to illustrate how to write the JSON object for generating unit test output to the3
file using Python:
The structured unit test JSON object will not render points. These still need to be calculated and written to a "points" JSON object. Learn more about how to do that in our Create a Custom Test guide.
pageCreate a Custom TestThis output format is supported by all AutoTest v2 test blocks including the Script block, the IO Test block and the Custom Test block.
Last updated