Google test: Can I query the name of the test fixture?
You can get a test name using TestInfo class: ::testing::UnitTest::GetInstance()->current_test_info()->name() You can find more details here
You can get a test name using TestInfo class: ::testing::UnitTest::GetInstance()->current_test_info()->name() You can find more details here
Google test was probably not properly installed (libgtest-dev may install only source files that needed to be compiled). I had the same problem and I followed the instructions from http://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/ sudo apt-get install libgtest-dev sudo apt-get install cmake # install cmake cd /usr/src/gtest sudo cmake CMakeLists.txt sudo make #copy or symlink libgtest.a and libgtest_main.a to … Read more
There are no needs to explicitly tell that no methods will be called. If you set the logging level high enough, you should get a message if a method is called (if no expectation is set). Other then that, you can set expectations like this : EXPECT_CALL( mockObj, Foo(_) ).Times(0); on all methods.
Google Test only recognizes its own command-line options. Each time it finds one, it removes it from argv and updates argc accordingly, so after InitGoogleTest returns, anything left over in argv is available for you to process yourself. Use your favorite command-line-parsing technique, store the results in some global variable, and refer to it during … Read more
the only reasonable difference is that gtest_main.lib provides a default implementation of a test application entry point (i.e. main function): Citation from Getting started with Google C++ Testing Framework: “[…] maybe you think that writing all those main() functions is too much work? We agree with you completely and that’s why Google Test provides a … Read more
Use EXPECT_NEAR or the DoubleEq matcher instead. Floating point operations can lead to rounding errors which makes the results ever so slightly different.
“Google Mock is not a testing framework itself. Instead, it needs a testing framework for writing tests. Google Mock works seamlessly with Google Test. It comes with a copy of Google Test bundled. Starting with version 1.1.0, you can also use it with any C++ testing framework of your choice. ” – Google Mock, System … Read more
A SEH (Structured Exception Handling) exception is not a C++-exception that can be handled using c++-language constructs (try-catch) but it is raised from windows itself and points to some fundamental flaw. SEH-exceptions are very annoying because they do not cause normal stack unwinding which can lead to unclosed files or not-unlocked mutexes that should normally … Read more
There isn’t any ready-to-wear combination of type-parameterized tests and value-parameterized tests. The googletest developers have been asked the question and they said No. However, there is a routine and simple way (as suggested by Zhanyong Wan in the linked discussion) in which you can craft you own type-parameterised test case that tests some condition for … Read more
MSBuild projectfile /property:Configuration=Debug http://msdn.microsoft.com/en-us/library/ms171452%28v=vs.80%29.aspx