Testing tool: Randomtest_nodisp

Randomtest is an incredibly useful testing tool. But my WIP is choice-dense, and each time I run randomtest, the recommended 10,000 iterations produce a result over half a million lines long. I need the line coverage statistics, but the output above it is huge.

Randomtest_nodisp is a solution for this problem. It’s exactly the same as randomtest, but it doesn’t print the random choices out along the way.

Get files and instructions here: http://www.sibylmoon.com/new-choicescript-tool-randomtest_nodisp/

(Also, if you’re confused about why randomtest is useful, I wrote about this tool here.)

2 Likes

EDIT: Realised my previous post may have come across as a bit harsh (that wasn’t the intention)
But would it not be easier to just comment out the log line(s) in randomtest.js?

  1. There are advantages to having an intact version of randomtest available as well.
  2. Not everyone who knows ChoiceScript, knows JavaScript.
  3. (relayed from the coder):

The actual engine uses console.log all over the place. If you comment out the lines in randomtest.js that redirect console.log to the screen (roughly lines 55-65), then you won’t get any output at all - not precisely optimal.

If, on the other hand, you just comment out the calls to console.log within randomtest.js, you won’t get any of the randomtest-specific messages (like “*****Seed 1” or “RANDOMTEST PASSED”) but you will still get all of the ChoiceScript engine debugging output, which is the vast majority of the output generated by the randomtest tool.

The alteration specifically assigns console.log to be a no-op so that all the normal ChoiceScript logging output gets suppressed, but the final line-by-line stats are still available. The one potential improvement I could see would be to make this behavior dependent on options selected in the randomtest form, so that users could have more control over exactly what output gets displayed by the tool, but I didn’t want to make changes to the original source files, since those are part of the ChoiceScript boilerplate.

Ohhhh. The blog post kinda makes it sound like it’s only printing the “***Seed” lines followed by “SUCCESSFUL/FAILED.”

Whoops. No, the whole point is to get the line coverage statistics. I updated the blog post to try to make that a bit clearer.

Randomtest stopped working for me for pretty much this reason. I can run the .html version of quicktest and randomtest on a Mac. Quicktest is a lifesaver, since it picks up all of the definite errors. Randomtest stopped working once I passed about 200 kb; it refused to not “show full text” despite my pleading un-check marks, and so running through and printing every single line reliably took forever and often crashed my browser.

…I also had quicktest utterly fail on me in one game I was trying to write, but I’m still trying to figure out what went wrong and whether it’s totally my fault.

I’ll give this a try, thanks very much for posting.

1 Like

This is now an official feature of ChoiceScript’s randomtest.

1 Like

Thank you for adding this!