Is Pex (Test generation) really usefull tool?
- by Yauheni Sivukha
Yes, it is possible to generate tests on boundary values for functions like "Sum" or "Divide". Pex is a good tool here.
But more often we create tests on business behaviour. Let's consider example from classic Beck's tdd book:
[Test]
public void ShouldRoundOnCreation()
{
Money money = new Money(20.678);
Assert.AreEqual(20.68,money.Amount);
Assert.AreEqual(2068,money.Cents);
}
Can this test be generated? No :) 95 % of tests in my projects check business logic, and can not be generated.
Pex (Especially in pair with Moles) can give 100% code coverage, but a high code coverage rate of a test suite does never indicate, that code is well tested - It only gives false confidence that everything is tested. And this is very dangerous.
So, the question is - Is Pex really usefull tool?