Is Pex (Test generation) really usefull tool?

Posted by Yauheni Sivukha on Stack Overflow See other posts from Stack Overflow or by Yauheni Sivukha
Published on 2010-04-24T13:47:33Z Indexed on 2010/04/24 13:53 UTC
Read the original article Hit count: 277

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?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about unit-testing