
Getting startedDownload the recent installer and run it. There are a few folders under the Typemock:
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:
Write the _tmain function to run the tests. With GTest it looks like this:
#include "stdafx.h"
#include 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. |