0

I want to change gmock warnings into errors in all uninteresting gmock function calls. I search some and I found that i should use --gmock_verbose=LEVEL flag but where should I add this flag? Unfortunately I couldn't change all NiceMocks to StrictMocks.

273K
  • 29,503
  • 10
  • 41
  • 64
  • this flag doesn't solve my issue, it just hide warnings. Is in Gmock any possibility to change warnings to errors without change NiceMock to StrictMock ? – Patryk Kaczmarek Sep 27 '17 at 10:11
  • That would be fundamental maintenance problem in your project if `NiceMock` start generating errors because of that - it is 100% against their design purposes. It is like requiring from good people to do bad things but - "please do not call them evil people"... Just use `StrictMock` - or create type-alias `ConfigurableMock` and once make it NiceMock, once StrictMock... – PiotrNycz Sep 28 '17 at 09:05

1 Answers1

0

where should I add this flag?

You can add gmock flags like --gmock_verbose=error directly in the command line.

Otherwise, you can always specify verbosity on a per test basis by putting ::testing::FLAGS_gmock_verbose = "error"; in the test code itself.

Source: http://google.github.io/googletest/gmock_cook_book.html#controlling-how-much-information-gmock-prints

Scott Madeux
  • 329
  • 3
  • 8