googletest

Comparison of c++ unit test frameworks

I know there are already a few questions regarding recomendations for c++ unit test frameworks, but all the answers did not help as they just recomend one of the frameworks but do not provide any information about a (feature) comparison. I think the most interesting frameworks are CppUnit, Boost and the new Google testing framework. Has...

Unit testing and mocking small, value-like classes in C++

Hi, I am trying to set up some unit tests for an existing c++ project. Here's the setup: I have chosen Google Mock, which includes Google Test. I have added another project (called Tests) to the Visual Studio Solution. The units to test are in another project called Main. The plan is to add each cpp file that I want to test to the Tes...

Unit testing mfc application backed with oracle?

App:MFC backed by oracle Unit testing framework:googletest I am going to unit testing the code that will be added here on to the project.Unit testing framework is googletest. I am new to unit testing. Is googletest is ok for my application how can I get started? ...

MSTest for huge legacy codebase

Hello, we have a huge codebase with about 1000k lines of native/unmanaged legacy c++ - code and we are going to provide the code with unit tests and MSTest would fit perfectly in our current development environment (TFS, VS 2010, ...). I know that MSTest is orginally meant to test managed code but its also possible to write unit tests ...

Switching from MSTest to another unit test framework in VS 2010

Hi, Visual Studio 2010 offers a lot of comfortable tools for unit testing via its built in test runner. Unfortunately we can't use MSTest for our unmanaged c++ codebase. Is it possible to switch from MSTest to e.g. Google.Test and have it integrated with the built in Visual Studio test runner? Thanks in advance! ...

How to get real code coverage using vsinstr/vsperfmon

Hi, my microsoft-based development environment looks like this: - huge native c++ codebase, seperated into 10 projects - each project has a dependent test project (GoogleTest unit tests), the sources to test are simply referenced. I generated the coverage-report using vsinstr and vsperfmon (the visual studio tools for instrumenting/...

Qt: What unit-testing framework?

I am just starting up a new project that needs some cross-platform GUI, and we have chosen Qt as the GUI-framework. We need a unit-testing framework, too. Until about a year ago we used an in-house developed unit-testing framework for C++-projects, but we are now transitioning to using Google Test for new projects. Anyone have any expe...

GoogleMock - Matchers and MFC\ATL CString

Hey All, I asked this question on the Google Group but I think I will get a faster response on here. I'm trying to use Google's Mocking framework to test my code. I am also utilizing their test framework as well. I'm compiling in VC9. I'm having issues matching arguments that are MFC\ATL CStrings. GMock says the objects are not equal ...

Force library linking with Qt and google test

Hi, I'm trying to write a test suit for my Qt(c++) application using google test, the main problem is that my application consists of one main program and various shared libs. Everything was working just fine, until I tried to do some code coverage using gcov/lcov (which don't operate on dynamic libs), so I modified all my .pro file to ...

Google Test and Visual Studio 2010 RC

Has anyone tried to build gtest 1.4.0 under VS 2010 RC? I get about 400 errors when I try to build it. Thanks in advance. ...

How to make google-test classes friends with my classes?

I heard there is a possibility to enable google-test TestCase classes friends to my classes, thus enabling tests to access my private/protected members. How to accomplish that? ...

C++ Mock/Test boost::asio::io_stream - based Asynch Handler

I've recently returned to C/C++ after years of C#. During those years I've found the value of Mocking and Unit testing. Finding resources for Mocks and Units tests in C# is trivial. WRT Mocking, not so much with C++. I would like some guidance on what others do to mock and test Asynch io_service handlers with boost. For instance, in ...

GoogleTest: Accessing the Environment from a Test

Hey! I'm trying out gtest for C++ (Google's unit testing framework), and I've created a ::testing::Environment subclass to initialize and keep track of some things that I need for most of my tests (and don't want to setup more than once). My question is: How do I actually access the contents of the Environment object? I guess I could th...

Writing a Makefile.am to invoke googletest unit tests

I am trying to add my first unit test to an existing Open Source project. Specifically, I added a new class, called audio_manager: src/audio/audio_manager.h src/audio/audio_manager.cc I created a src/test directory structure that mirrors the structure of the implementation files, and wrote my googletest unit tests: src/test/audio/aud...

C++ linking issue on Visual Studio 2008 when crosslinking different projects on same solution

I'm using Google Test Framework to set some unit tests. I have got three projects in my solution: FN (my project) FN_test (my tests) gtest (Google Test Framework) I set FN_test to have FN and gtest as references (dependencies), and then I think I'm ready to set up my tests (I've already set everyone to /MTd (not doing this was leadi...

Using ASSERT and EXPECT in GoogleTest

While ASSERT_* macros cause termination of test case, EXPECT_* macros continue its evaluation. I would like to know which is the criteria to decide whether to use one or the other. ...

How to migrate Cppunit tests into GoogleTest ?

I have a bunch of module tests written in CPPunit with some mocks created by hand. I am looking for a way to migrate them to GoogleTest as smoothly as possible. Have you tried such an operation? What was the effort needed? ...

How do I prevent qFatal() from aborting the application?

My Qt application uses Q_ASSERT_X, which calls qFatal(), which (by default) aborts the application. That's great for the application, but I'd like to suppress that behavior when unit testing the application. (I'm using the Google Test Framework.) I have by unit tests in a separate project, statically linking to the class I'm testing. The...

Use Google Test from Qt in Windows

I have a simple test file, TestMe.cpp: #include <gtest/gtest.h> TEST(MyTest, SomeTest) { EXPECT_EQ(1, 1); } int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } I have Google Test built as a static library. (I can provide the makefile if it's relevant.) I can compile TestMe.cpp f...

GoogleMock and GoogleTest in Visual Studio 2010

Has anyone successfully built gmock and gtest in Visual Studio 2010? I've tried with version 1.5.0, but I only get incomprehensible compilation errors. ...