NUnit

Top  Previous  Next

Purpose

SeSNUnit.vsi is a visual studio installer packaged with SmarteStudio.  It facilitates calling SmarteStudio tests from NUnit tests.

 

Usage

 

Installation

You will need Visual Studio and NUnit to use SeSNUnit.  NUnit is available at http://www.nunit.org/index.php?p=download.

 

To install SeSNUnit, open the following directory:

C:\Program Files\SmarteSoft\SmarteStudio\Extensions\UnitTesting\NUnit\SeSNUnit

 

Double-click SeSNUnit.vsi.  The Visual Studio Content Installer will appear.  Select the components for the language you will use and then click Next.

 

Syntax

Use both the NUnit.Framework and the SeSNUnit namespaces:

 

using NUnit.Framework;
using SeSNUnit;

 

NUnit uses the class attribute [Test] to identify test methods.  The corresponding attribute for SeSNUnit is [SeSNUnitTest(@"<path to .sstest>")].  Note that the SeSNUnitTest attribute has a parameter, the file-path to the test that will be invoked.

 

The following example uses a test method simply as a wrapper for calling an .sstest:

 

[SeSNUnitTest(@"T:\Samples\Cross Browser\CrossBrowser.sstest")]

public void TestIEandFirefox()

{

   int exitCode = SeSNUnitHelper.TestExecute();

   Assert.AreEqual(0, exitCode);

}

 

Templates

SeSNUnit.vsi will install a template for Visual Studio called SeSNUnitTests.  The template includes the appropriate using statements and a blank test method.  You can insert additional SeSNUnitTest methods by right-clicking in the editor in Visual Studio, and selecting Insert Snippet > SeSNUnitTest.  The following code will be added:

 

[SeSNUnitTest(/*Insert path to .sstest file which must be run.*/)]

public void TestSeS()

{

   int exitCode = SeSNUnitHelper.TestExecute();

   Assert.AreEqual(0, exitCode);

}

 

You'll need to specify the file-path.

 

Samples

There is a sample dll you can run in NUnit.  From the SmarteStudio directory, you'll find it at: Extensions\UnitTesting\NUnit\SeSNUnit\SeSSamplesNUnit\bin\Debug\SeSSamplesNUnit.dll

 

See Also

NUnit and related documentation can be found at www.nunit.org