Questions tagged [googletest]

Google's C++ testing framework based on xUnit that runs on multiple platforms.

GoogleTest is an open source unit testing framework developed by Google. It also supports unit testing of C code.

GTest (as it is commonly known) supports various platforms including Linux, OS X, Windows and Symbian. It provides basic unit testing features in the xUnit model in the form ASSERT_EQ() or EXPECT_EQ(), with automatic test registration. It also provides advanced features such as death tests, shuffling and sharding of tests, and Hudson/Jenkins-compatible XML output.

GTest integrates well with gmock, a C++ mocking framework.

There are three GTest related open source projects which can enhance the GTest user experience:

  1. Google Test UI - provides a GUI for running gtest binary and displaying the results.
  2. GTest TAP listener - Event listener for GTest based on TAP, for test result output.
  3. gtpp - Google Test Pretty Printer, offering shorter and clearer console test output
2773 questions
1
vote
3 answers

Building gtest for MSVC: 32bit or 64bit?

Here is excellent guide for setting up google-test in Visual Studio. Unfortunately, it omits whether one should build gtest always for win32 or for the same platform as the project being tested (step 3 of 2nd paragraph). So how should I build gtest…
Dmitry J
  • 867
  • 7
  • 20
1
vote
2 answers

Build Google Test like shared library

I have the project with many subprojects, and one of them is google test project. I must build google test library as shared library every time when I build the main project, but single way to build the google test as shared is setting global option…
voltento
  • 833
  • 10
  • 26
1
vote
1 answer

Compile gtest from source with catkin

I am trying to compile gtest from source (instead of using the existing installed version). I am working on a catkin based cmake project. I have added the sourcecode from https://github.com/google/googletest to my workspace and included the folder…
cbandera
  • 105
  • 9
1
vote
1 answer

Getting an instance of JNIEnv in an Android Native Executable

I have an NDK shared library and I want to do some tests against it. I currently used googletest to create an native executable that links to the library, followed instructions in the README.NDK. A dummy executable can run on a Android emulator.…
ZillGate
  • 1,173
  • 12
  • 22
1
vote
1 answer

Use TypedEq() to match the type std::vector

I have 2 mock method struct temp_struct { int x; }; using range = std::vector>; Class MockA: public A { public: MOCK_METHOD1(write_data, int(int a, int b)); MOCK_METHOD1(write_data, int(int a, const range…
Anip Patel
  • 55
  • 7
1
vote
2 answers

EXPECT_THROW - Actual: it throws a different type, google tests

Hi guys so i have this constructor Matrix::Matrix(size_t row, size_t col) { if(row < 1 || col < 1) throw new std::runtime_error("Minimalni velikost matice je 1x1"); matrix = std::vector >(row,std::vector(col,…
Crky
  • 13
  • 1
  • 1
  • 4
1
vote
1 answer

Advanced use of googletest's parameterization

I have several questions about googletest framework and its usage: By fixture in the following questions I mean a class derived from ::testing::Test As far as I know, I can use fixture along with parameterization feature of gtests. Does this…
andrgolubev
  • 825
  • 6
  • 21
1
vote
0 answers

Visual Studio 2015 does not break on assert in gtest

When I debug a normal application and assert() happens, I get the usual error window which allows me to stop execution and analyze call stack, local variables etc, which is very convenient: However when I am running a Google Test unit test,…
Aleksei Petrenko
  • 6,698
  • 10
  • 53
  • 87
1
vote
1 answer

C++ Google Test Where to Put Test Fixture Constructor Definition

I'm using Google Test for my C++ code recently. When I read how to setup the test fixture for tests, I get a little bit confused. The Writing the main() Function session showed an example about what the test fixture class looks like. However, when…
Dreamer
  • 563
  • 1
  • 8
  • 25
1
vote
0 answers

a way to execute android app functions with gtest

I am working with visual studio and want to make tests go through all functions of my Android app with different options. I simply don't want do it manually by hand to see if all functions work. I'd like to do this just with the emulator with a 5…
Alex.S
  • 33
  • 7
1
vote
0 answers

Gtest per test tear down after fixture destructor

I know that Gtest has a TearDown, but it is called before the destructor of the fixture class is called. I also know that there is the TearDownTestCase, which is called after all the tests using that fixture are executed and after the last instance…
Nogoseke
  • 969
  • 1
  • 12
  • 24
1
vote
1 answer

Cucumber-cpp step defiinition runner exits immediately

Based on the instructions given at cucumber-cpp github repo and cucumber-cpp step definition quick-start guide , I created my cucumber step definition files. The features and their step_definition files are under features/ folder, and the cpp code…
Akaedintov
  • 747
  • 1
  • 6
  • 17
1
vote
0 answers

Can I force cygwin to show colors like dos prompt when running GoogleTest?

It is a fact that for terminals that support ascii escape characters, one can use those escapes to colorize a string as described here: ANSI Color Specific RGB Sequence Bash std::cout << "\x1b[93;0m " << " this will be colored text! " …
peter karasev
  • 2,578
  • 1
  • 28
  • 38
1
vote
0 answers

mingw32 on Windows10 : compiling errors "cannot convert 'CRITICAL_SECTION*" for googletest (gtest-1.8.0)

I've installed mingw32 , downloaded gtest-1.8.0 in C:\gtest-1.8.0. I've launched the command C:\gtest-1.8.0\googletest\make>mingw32-make g++ -isystem ../include -g -Wall -Wextra -pthread -c ../samples/sample1.cc g++ -isystem ../include -g -Wall…
Yborf
  • 11
  • 6
1
vote
2 answers

Error: LINK: fatal error LNK1561: entry point must be defined c++

I am getting the following error when trying to compile my code: error LNK1561: entry point must be defined. Background: I am trying to run a Win32 CONSOLE application and use the Google Tests framework. I have my main function setup and I've…
WitchKing17
  • 185
  • 3
  • 21
1 2 3
99
100