Interested in a
Personal Demo ?


Name* :
Please Enter your Name
Company E–Mail* :
Please Enter a Valid Email

Testimonials


"Holy crap, this thing is hot. In technical terms, you might call it the *bomb-diggity*. I haven’t been this stoked about a technology for quite some time..."
Travis Illig, Senior Software Engineer, Fiserv
Success stories

PurchaseOptions


US Toll Free
866–895–4680
Outside US
+44–203–150–0293
Get your printable quote
Buy online

 « How to change behavior with Isolator++ | Main | Isolator++ Beta Released »

Getting Started

Download the recent installer and run it. There are a few folders under the Typemock:

  • Bin: contains the Isolator.lib header file. You’ll need this to link to your test project.
  • Include: contains the Isolator.h header file. You’ll need this to compile your test project.
  • Examples: A solution containing examples of Isolator++ features
  • GTest: Google testing framework. You’ll need this to run the examples.

 Isolator++ tests runs inside an executable. To start, create a new C++ Console Application.

  

Make sure the project is compiled to a console application:

 

Open the project properties. Add the Isolator++ include folder to the include directories.

Add the Isolator.lib to the linker input list

  

Set up additional includes and libraries, for the test frameworks and the code under test. For GTest, which is deployed with Isolator++, use:

  • Add the GTest Include folder: "C:\Program Files\Typemock\Isolator\gtest\Include"
  • Add the GTest library: "gtestd.lib"

Write the _tmain function to run the tests. With GTest it looks like this:

#include "stdafx.h"
#include <gtest\gtest.h>


int _tmain(int argc, _TCHAR* argv[])
{
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}

 

Write tests using your test framework, in a separate cpp file. In GTest, TEST_F identifies a test, the first argument is the name of the test, and the second is the scenario. For example:

// Changing return value
TEST_F(IsolatorTests, ChangeReturnedIntValue)
{
WHEN_CALLED(fakeConcrete->GetInt()).Return(5);
      ASSERT_EQ(5, fakeConcrete->GetInt());
}

Compile and run the console application to run the tests. With GTest, results look like this:

In the result window, you’ll see which tests passed, and which didn’t.

That’s it! You’ve just run your first tests. It’s time to learn more on Isolator++ features.