Would it be possible to have an overt request, perhaps even in its own box, that the Asker provide information about their testing process.

Obviously wording up for dispute, but something like: "How have you tested your code? Please provide example inputs and outputs if possible."

Explicit test cases, whether as part of a unit testing framework or just examples in a main function, can provide additional context for understanding the behaviour of the code. They obviously facilitate regression testing, if the answerer wants to suggest edits. They also provide a potentially useful aspect of the code to comment on, such as mentioning that only the happy path is exercised by tests.

The question also helps reinforce an expectation that the code should indeed be tested before being posted for review. It's not appropriate to always require fixed inputs and outputs: for example it may not work with playtesting a real time game built around a random number generator. It shouldn't be a problem if they say "I played the game a few times" but at least it'll prompt thinking and ensure everyone's on the same page.

  • 1
    \$\begingroup\$ This would address one of the things in Simon's Guide to a good question, I've been starting to think about having a "question template" that could make it easier for newcomers to ask their first question(s)... \$\endgroup\$ Jun 4, 2018 at 21:04
  • \$\begingroup\$ I'm hugely in favour of anything contributing to less crap getting posted (accidentally). If this works even a bit, we should do it. \$\endgroup\$
    – Mast Mod
    Jun 5, 2018 at 14:48


You must log in to answer this question.

Browse other questions tagged .