I have revamped my TestFixture generator to work with the StatementGraph (i.e. FlowGraph). The generator logics has not changed:
Disclaimer
Examples
Here's a sample of what gets output from the examples in the StatementGraph article. Targetted statements are marked with /* i */ where i is the index of the tested statement
/// <summary>Test fixture for the <see cref="StatementSamples"/> class</summary>/// <remarks />[TestFixture()]public class StatementSamplesTest{ /// <summary>Tests the Simple method</summary> /// <remarks> /// <para>Test coverage (estimated): 100,0%</para> /// <para>Target path:</para> /// <code>/* 0 */ Console.WriteLine("hello"); /// </code> /// </remarks> [Test()] [Ignore("NotImplemented")] public virtual void Simple0() {} /// <summary>Tests the Block method</summary> /// <remarks> /// <para>Test coverage (estimated): 100,0%</para> /// <para>Target path:</para> /// <code>/* 0 */ Console.WriteLine("hello"); /// /* 1 */ Console.WriteLine("world"); /// </code> /// </remarks> [Test()] [Ignore("NotImplemented")] public virtual void Block0() {} /// <summary>Tests the If method</summary> /// <remarks> /// <para>Test coverage (estimated): 83,3%</para> /// <para>Target path:</para> /// <code>/* 0 */ if (value < 0) /// { /// /* 1 */ Console.WriteLine("true"); /// /* 2 */ return; /// } /// Console.WriteLine("false"); /// </code> /// </remarks> [Test()] [Ignore("NotImplemented")] public virtual void If0() {} /// <summary>Tests the If method</summary> /// <remarks> /// <para>Test coverage (estimated): 50,0%</para> /// <para>Target path:</para> /// <code>/* 0 */ if (value < 0) /// { /// Console.WriteLine("true"); /// return; /// } /// /* 1 */ Console.WriteLine("false"); /// </code> /// </remarks> [Test()] [Ignore("NotImplemented")] public virtual void If1() {} /// <summary>Tests the While method</summary> /// <remarks> /// <para>Test coverage (estimated): 100,0%</para> /// <para>Target path:</para> /// <code>/* 0 */ int num1 = 0; /// while ((num1 < 10)) /// { /// /* 1 */ Console.Write(num1++); /// } /// </code> /// </remarks> [Test()] [Ignore("NotImplemented")] public virtual void While0() {}}
[TestFixture()]
{
[Test()]
[Ignore("NotImplemented")]
}
Page rendered at Monday, September 08, 2008 6:52:14 PM UTC
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.