6 ms·
How is this different from a set of unit tests where you give the function under test each of those inputs and have the expected output be the same for each ent
by t-writescode 6y ago
How is this different from a set of unit tests where you give the function under test each of those inputs and have the expected output be the same for each entry as the given list of outputs?
e.g.
[TestCase(null, null)]
[TestCase(10, 11)]
[TestCase('abc', 'abc')]
[TestCase('dd1', 'dd1')]
[TestCase(500, 500)]
[TestCase([200, 'dd1'], [200, 'dd1'])]
public void StateChanges(input, expected) {
actual = DoThing(input);
Assert.AreEqual(actual, expected);
}
- exdsq 6y agoBecause this is only checking the individual function, not the entire systems state. If I have a function that adds two ints I could test it with [TestCase([2, 2], 4)] and this would pass but if it also changed the value of an object there could be an issue a unit test (and indeed integration/e2e test) wouldn't catch.