This project is read-only.

Create Your First Test Project

Creating a test project involves just creating a DLL. Here's how to do it in Visual Studio 2008.
Note: These instructions assume you have unzipped the download in a directory called C:\WinUnit.

1. Create a new Visual C++ "Empty Project" project through the File --> New... --> Project... menu item. Name it MyTest.


2. Add a new C++ file to the project through the File --> New... --> File... menu item. Name it MyTests.cpp.


3. Right-click on the project in Solution Explorer and select Properties.

a. On the General page, set Configuration Type to Dynamic Library (.dll).


b. On the C/C++ | General page, add an item to Additional Include Directories pointing to the directory containing WinUnit.h.


3. Put the following code in the file MyTests.cpp.

  // MyTests.cpp
  #include "WinUnit.h"

    WIN_ASSERT_TRUE(3 > 4);

    WIN_ASSERT_TRUE(4 > 3);

4. Build the project.

5. You are now ready to run the tests.
You will see an indication that one test passed and the other failed. Now you can experiment and add real tests!

Last edited Sep 12, 2009 at 4:54 AM by mkblees, version 9


rdawson999 Nov 16, 2012 at 4:41 PM 
Try using the x86 Winunit.exe instead of the 64 bit version.

Macpeters Sep 20, 2012 at 1:05 AM 
I am getting LoadLibraryW failed - no tests were run. Has anyone else gotten this?