As you may noticed that Spec Explorer is actually available for VS2008 Professional edition, but VS2008 professional edition don’t include VSTS (And it is great that VS2010 Beta2 professional edition already include VSTS). Then if you installed Spec Explorer for VS2008 Professional Edition, you may not be able to build or run the generated test codes.

The design of test code generation (TCG) engine enabled generating test codes for NUnit test framework. Following are steps that you can follow to generate test codes for NUnit test framework with Spec Explorer:

  1. Create a new Spec Explorer project.

     1

    2
  2. Remove reference “Microsoft.SpecExplorer.Runtime.VisualStudio.dll” and “Microsoft.VisualStudio.QualityTools.UnitTestFramework” from your test project.
  3. Delete content of file AccumulatorTestSuite.cs in test project.
  4. Open Config.cord file in Model project.
  5. Remove “switch TestClassBase = "vs";” from Config.cord file.
  6. Set several testing related switch in cord file. 

    3
       
  7. Add reference “nunit.framework.dll” to test project.
  8. Add a file NUnitTestClassBase.cs  to test project with following content.

    using System;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.SpecExplorer.Runtime.Testing;
    using NUnit.Framework;

    namespace NUnitExtension.TestSuite
    {
        public class NUnitTestClassBase : GeneratedTestClassBase
        {
            public override void BeginTest(string name)
            {
                Console.WriteLine("Beging executing test " + name);
            }

            public override void EndTest()
            {
                Console.WriteLine("End executing test");
            }

            public override void Assert(bool condition, string description)
            {
                if (!condition)
                {
                    throw new AssertionException(description);
                }
            }

            public override void Assume(bool condition, string description)
            {
                if (!condition)
                {
                    throw new AssertionException(description);
                }
            }

            public override void Checkpoint(string description)
            {
                Console.WriteLine("Reaching checkpoint: " + description);
            }

            public override void Comment(string description)
            {
                Console.WriteLine(description);
            }
        }
    }

  9. Open Exploration Manager tool window.

    4
  10. Select machine and generate test suite.

    5 
  11. Build and run the generated test codes with NUnit.