2 ms·
Does anyone generate tests automatically? I've been looking for something related to this. Whenever I design unit test cases, I write out the common edge case
by tedmiston 10y ago
Does anyone generate tests automatically?
I've been looking for something related to this. Whenever I design unit test cases, I write out the common edge cases, let's say: valid input, invalid input (wrong data type), invalid input (too long), etc, then translate them into tests. I might write them in a way that the tests are the combination of various dimensions of input, one per variable. For example, try input1=['a', 'aaa', None] x input2=[-1, 0, 1, None] for each combination knowing which I expect to pass and fail.
Often the tests are similar (write one, duplicate, slightly change the logic), and I've always felt like there has to be some kind of test generation framework out there to do this, though I haven't heard of anyone actually using one.
- joshschreuder 10y agoI haven't used it (I think Microsoft has abandoned the project anyway), but I think this was one of the goals of Pex (https://www.microsoft.com/en-us/research/project/pex-and-moles-isolation-and-white-box-unit-testing-for-net/ https://www.microsoft.com/en-us/research/project/pex-and-mol...) Looks like it became Intellitest (https://www.visualstudio.com/news/vs2015-vs#Testing https://www.visualstudio.com/news/vs2015-vs#Testing). But I'm not convinced such high test coverage is useful in most scenarios.
- bryanh 10y agoImmediately QuickCheck comes to mind (https://hackage.haskell.org/package/QuickCheck https://hackage.haskell.org/package/QuickCheck). Folks have written (possibly less powerful) implementations in Python (https://github.com/HypothesisWorks/hypothesis-python https://github.com/HypothesisWorks/hypothesis-python), Javascript (https://github.com/jsverify/jsverify https://github.com/jsverify/jsverify), etc. FWIW I've found them fragile and lacking for my use cases - but I bet fuzzing style testing tools could be pretty valuable in certain cases.