> See the list of available templates

A template is what the recorder uses to format code. The files are located in the "Templates" directory with the main application and have an extension of ".trt" for Test Recorder Template.

The real power of a template is that it gives you the ability to wrap your own assemblies and code around a test, outputting the source code meaningful to you. We recommend that you add a new template rather than change an existing file so installing a new version will not overwrite your templates.

There are a few parts to the template:

  • TemplateName - name of the template as you want it to appear on the drop-down lists
  • CodeLanguage - language of the template, currently only "CSharp", "VBNet", and "PHP" are supported
  • CanRun - indicates whether this template should be shown in the "Run" list
  • CanCompile - indicates whether this template should be shown in the "Compile" list
  • FileExtension - extension for the save dialog box
  • ReferencedAssemblies - .NET assemblies necessary for compilation
  • code - formatted code page showing where the methods should go
    • TESTMETHODLIST is replaced by a list of the test methods
    • TESTMETHODCODE is replaced by the code, formatted using the Method format (below)
  • Method - format of a single test method
    • TESTNAME is replaced by the name you gave the test
    • TESTCODE is replaced by the recorded code
  • IncludedFiles - addition source files necessary for compilation
  • StartupApplication - application to start with recorder output as a parameter. An entry of "php.exe" here would start a process like "php.exe testcode.php"

Here is an example template:

  <TemplateName>C# Console</TemplateName>
using System;
using System.IO;
using System.Threading;
using WatiN.Core;
using WatiN.Core.DialogHandlers;
using WatiN.Core.Exceptions;
using WatiN.Core.Interfaces;
using WatiN.Core.Logging;

namespace TestSpace
	public class TestClass
		static void Main()
public static void TESTNAME ()

> See the list of available templates