9. Identify Test Inputs
• Pex doesn’t make wild guesses
• Pex gains an understanding of your code
• Static and dynamic analysis
• Every input should increase code coverage
10. Parameterised Unit Tests
[RowTest]
[Row(1, 2, 3)]
[Row(-1, -2, -3)]
public void TestForAddMethod(int a, int b, int
expected)
{
int test = MyMethods.Add(a, b);
Assert.AreEqual(test, expected);
}
11. Parameterised Unit Tests
[RowTest]
[Row(1, 2, 3)]
[Row(-1, -2, -3)]
public void TestForAddMethod(int a, int b, int
expected)
{
int test = MyMethods.Add(a, b);
Assert.AreEqual(test, expected);
}
21. Lots of people think they are
writing tests but in reality they
aren’t
22. [Test]
public void Test1()
{
Engine e = new Engine();
Customer c = e.GetCustomer(123);
Order o = new Order(1, “Product X”)
o.Customer = c;
Assert.IsTrue(e.PlaceOrder(o));
}
23. Those who are, 100% code
coverage is rare
Especially with Legacy Code