Boost :: Testing and Taunt

I am using boost :: test and you need to use a fake framework. Does anyone have any recommendations?

+6
source share
5 answers

I recently did a search for unit testing and mocking frameworks for my latest project and went with Google Mock . He had the best documentation and it looks pretty good (although I haven't created very complex layout objects yet). At first I thought about using boost::test , but instead used Google Test (I think this is a prerequisite for Google Mock, even if you use another). It also has good documentation and has most of the features that I expected.

+7
source

Fake-It - a simple fake framework for C ++ uses the latest C ++ 11 features to create an expressive (but very simple) API. With FakeIt there is no need to re-declare methods or create a derived class for each layout, and it has built-in boost integration :: test. This is how you fake-it:

 struct SomeInterface { virtual int foo(int) = 0; }; // That all you have to do to create a mock. Mock<SomeInterface> mock; // Stub method mock.foo(any argument) to return 1. When(Method(mock,foo)).Return(1); // Fetch the SomeInterface instance from the mock. SomeInterface &i = mock.get(); // Will print "1" cout << i.foo(10); 

There are many opportunities to explore. Go ahead and try .

+7
source

You can try Turtle !

+6
source

Here you have an example of using Google Mock with Boost Test. I prefer the Boost test because I often use other Boost libraries .

+6
source

GoogleMock has a section on using with a different framework .

+2
source

Source: https://habr.com/ru/post/893142/


All Articles