Note that there are some explanatory texts on larger screens.

plurals
  1. POTesting with random inputs best practices
    primarykey
    data
    text
    <p><strong>NOTE</strong>: I mention the next couple of paragraphs as background. If you just want a TL;DR, feel free to skip down to the numbered questions as they are only indirectly related to this info.</p> <p>I'm currently writing a python script that does some stuff with POSIX dates (among other things). Unit testing these seems a little bit difficult though, since there's such a wide range of dates and times that can be encountered.</p> <p>Of course, it's impractical for me to try to test every single date/time combination possible, so I think I'm going to try a unit test that randomizes the inputs and then reports what the inputs were if the test failed. Statisically speaking, I figure that I can achieve a bit more completeness of testing than I could if I tried to think of all potential problem areas (due to missing things) or testing all cases (due to sheer infeasability), assuming that I run it enough times.</p> <p>So here are a few questions (mainly indirectly related to the above ):</p> <ol> <li>What types of code are good candidates for randomized testing? What types of code aren't? <ul> <li>How do I go about determining the number of times to run the code with randomized inputs? I ask this because I want to have a large enough sample to determine any bugs, but don't want to wait a week to get my results.</li> <li>Are these kinds of tests well suited for unit tests, or is there another kind of test that it works well with?</li> <li>Are there any other best practices for doing this kind of thing?</li> </ul></li> </ol> <h3>Related topics:</h3> <ul> <li><a href="https://stackoverflow.com/questions/32458/random-data-in-unit-tests">Random data in unit tests?</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload