From what I understand: With parameterized tests, you can put a number of static inputs into a test file.
Theories are similar, but different in concept. The idea behind them is to create test cases that are tested based on assumptions, not static values. Therefore, if my test data provided is true in accordance with some assumptions, the obtained statement is always deterministic. One of the driving ideas is that you can provide an infinite amount of test data, and your test case will still be true; In addition, often you need to check all the possibilities of the possibilities in the test input, for example, negative numbers. If you check it statically, that is, put a few negative numbers, it is not guaranteed that your component will work against all negative numbers, even if it is very likely.
From what I can tell, xUnit frameworks are trying to apply theories of theories by creating all possible combinations of the test data you provide.
Both should be used when approaching the scenario in a data-driven scenario (i.e. only the inputs are changed, but the test always makes the same statements over and over).
But since theories seem experimental, I would only use them if I needed to check the sequence of combinations in my input. For all other cases, I would use Parameterized Tests.
Fabio Kenji May 03 '11 at 23:28 2011-05-03 23:28
source share