How To Use GenTestAsm

Programming Tools & Info

Download GenTestAsm (198K zip file)
More about GenTestAsm

What Is GenTestAsm

GenTestAsm takes unmanaged (e.g., C++) DLL as input and generates managed assembly loadable by nUnit test tool. For each DLL export whose name starts with certain prefix (UnitTest by default), GenTestAsm will generate a unit test which will call this export. Export signature must be

extern "C" BSTR __cdecl Export();

Command Line Options

GenTestAsm's command line looks as follows:

GenTestAsm [/nocompile] [/prefix:foo] input.dll output.dll

input.dll is a name of unmanaged DLL whose exports will be examined by GenTestAsm. This parameter is required.

output.dll is a name of managed assembly that contains unit tests. This parameter is required.

/nocompile option tells GenTestAsm to generate C# source code instead of binary assembly. The source code will be placed in the file named output.cs

/prefix:foo tells GenTestAsm to process only exports whose names start with "foo". Empty prefix (/prefix:) means that all named exports will be processed. GenTestAsm will never process symbols exported only by ordinal. This parameter is optional. Default prefix value is UnitTest

Examples

GenTestAsm my.dll my_test.dll
reads unamanged DLL my.dll and creates managed assembly my_test.dll. A unit test will be created for every export whose name starts with UnitTest.

GenTestAsm /prefix:Special my.dll my_test.dll
reads unamanged DLL my.dll and creates managed assembly my_test.dll. A unit test will be created for every export whose name starts with Special.

GenTestAsm /nocompile /prefix:Special my.dll my_test.dll
reads unamanged DLL my.dll and creates C# source file my_test.cs. A unit test (source code) will be created for every export whose name starts with Special.