googletest Questions

1

Solved

I want to run the sample tests and debug the Google Test project. I am using VS Code on Ubuntu 16.04 LTS. I cloned the project locally at /home/user/Desktop/projects/cpp/googletest, created a new ...
Pahari asked 15/7, 2020 at 8:39

4

I am getting a segmentation fault when I try running gtest by mocking a method that accepts pointer to a object as the argument. I identified the mock method that is creating the trouble. class Nv...
Bellebelleek asked 8/8, 2014 at 10:5

2

Solved

I am running an experiment in trying to link google test to ada95 for unit testing. I know ada has aunit and ahven, but this is just to see if this is possible and is outside of the scope of my que...
Arlon asked 25/6, 2020 at 23:45

4

Since there's basically no documentation on the Google Test webpage—how do I do that? What I have done until now: I downloaded googletest 1.6 from the project page and did a ./configure &am...
Idelia asked 4/4, 2013 at 14:13

1

Solved

Here is my project hierarchy ProjectMain | Project 1 | | | tests | Project 2 | tests CMakeLists of ProjectMain downloads and sets up google test as per https://github.com/google/googlete...
Aflame asked 4/6, 2020 at 2:49

3

Solved

To test my C++ project I am using GoogleTest framework. Normally I can use the following syntax to easily debug a failure: EXPECT_TRUE(*statement*) << *debugMessage*; When I use the macro ...
Cham asked 22/3, 2017 at 15:46

1

I'm currently working on migrating our current build environment from MSBuild to CMake. I have a situation where I need to update the PATH variable in order for the units tests executable to run. T...
Mcmath asked 18/8, 2019 at 4:52

2

The Google Mock documentation says: Important note: Google Mock requires expectations to be set before the mock functions are called, otherwise the behavior is undefined. In particular, you must...
Dialectology asked 17/10, 2016 at 14:35

4

Background (skip to Question below if not interested) I have a simulator that runs through three states: Single threaded startup (I/O ok) Multi-threaded in-memory CPU-bound simulation stage (I/O n...
Savoirvivre asked 19/12, 2011 at 18:25

6

I successfully run my unit test with google test in Jenkins, but I don't know how to show the .xml file generated by gtest. It is said that gtest satisfies the JUnit format, so what I set is as fol...
Aceous asked 18/7, 2012 at 11:47

4

Solved

How google-test makes test sequence (or order of test case execution) for testing test cases? Suppose I have 5 test cases. TEST(First, first) TEST(Secnd, secnd) TEST(Third, third) ... TEST(Fifth,...
Publication asked 5/10, 2012 at 9:12

6

Solved

I am trying to do a test for a function using GoogleTest an now it is not finding anymore the EqFailure thing: /usr/include/gtest/gtest.h:1337: undefined reference to `testing::internal::EqFailure...
Impost asked 18/7, 2014 at 8:37

3

Solved

If I call EXPECT_CALL twice on the same mock object in the same TEST_F . . . what happens? Are the expectations appended to the mock object or does the second call erase the effects of the first c...
Mozart asked 17/5, 2017 at 20:55

2

Solved

I need to detect that a given function has been called exactly ONCE with a certain set of arguments. EXPECT_CALL(Mock_Obj, func("abc")).Times(1) but it's ok for that function to be called with di...
Cheyney asked 29/5, 2017 at 19:25

2

Solved

I have a set of typed test cases in google test. However, some of these test cases are simply not applicable for a specific type parameter. Consider this example typed test case: TYPED_TEST_P(TheT...
Kingsley asked 23/9, 2014 at 15:30

0

It's tremendously helpful that there's a tool to generate mock versions of the client stubs. Testing the server side is causing me tons of headache at the moment. Enough headache where I feel like ...
Documentation asked 17/3, 2020 at 15:53

2

Solved

So I am trying to learn how to write unit Tests and i stumbled upon the problem, that I don't understand how to create mock objects. Here's my example: I have this class: class FooChild { public: ...
Davidadavidde asked 4/3, 2020 at 7:52

1

This is going to be a self-answered, FAQ-style question. See answer below. With Visual Studio 2017/2019 it is really easy to set up a new Google Test project and start writing tests (as long as you...
Ingeringersoll asked 2/3, 2020 at 9:42

2

I need to mock the following function: virtual void fun() noexcept = 0; Is it possible using gmock ? Gmock has the following macro:#define GMOCK_METHOD0_(tn, constness, ct, Method, ...) but t...
Khano asked 15/7, 2019 at 21:23

1

I use Ctest to run a bunch of google tests that I have registered using add_test(). Currently, these tests do not take any arguments. However, I want to give them all arguments (common to all, spec...
Betweentimes asked 6/7, 2016 at 21:13

3

I use value-parameterized tests in gtest. For example, if I write INSTANTIATE_TEST_CASE_P(InstantiationName, FooTest, ::testing::Values("meeny", "miny", "moe")); then in the output I see test ...
Damnedest asked 31/7, 2013 at 7:24

1

Solved

I'm porting a Qt desktop application to Linux (Ubuntu 19.10, 64bit desktop, Qt 5.12.5, gcc version 9.2.1), and am seeing some unexpected threads remaining alive after QApplication is finished. Her...
Stephniestepladder asked 4/1, 2020 at 18:26

2

I'd like to write C++ Google tests which can use value-parameterized tests with multiple parameters of different data types, ideally matching the complexity of the following mbUnit tests written in...
Spelter asked 6/6, 2011 at 19:4

0

This code will run the TestMultiTypes test for both the [float, double] and [char, int] type pairs: template <typename T> class UtilsTestFixture2Types : public ::testing::Test {}; using Tes...
Crossexamine asked 3/12, 2019 at 16:22

1

I am trying to use googletest with CMake/Ctest. I have several sources files for my tests (each one containing many TEST/TEST_F/... commands) which are located in several directories. I want that t...
Afloat asked 14/6, 2018 at 16:0

© 2022 - 2024 — McMap. All rights reserved.