How to transfer Cppunit tests to GoogleTest?

I have a bunch of unit tests written in CPPunit with some manual layouts. I am looking for a way to transfer them to GoogleTest as smoothly as possible. Have you tried such an operation? What were the efforts?

+4
source share
3 answers

Google Test and Cppunit seem to have somewhat the same syntax for calling tests, but I suspect there are too many differences in this syntax.

I am pretty sure that you cannot automate it in any way, and this operation will require rethinking and re-arranging your tests in order to follow the Google Test semantics (if you use something specialized to create your mocks, and then transfer them to Google Mock it would have taken even more effort, simply because the Google Mock approach is not obvious and actually complicated).

I would say that you better rethink the following questions: “why should I transfer my tests”, “what will be the benefit of this operation” and “do I really want to learn a completely new testing structure and then rewrite all my tests for some purpose” .

+1
source

It seems you can use the google test from a different structure (cppunit, in your case): https://code.google.com/p/googletest/wiki/AdvancedGuide#Letting_Another_Testing_Framework_Drive

+2
source

To some extent, I agree with @Kotti. Automatic conversion will not be trivial for tests, so you will need to think about whether the number of existing tests is worth the effort.

I’m a big fan of the GoogleMock framework, and if you make significant investments in manual mockery, moving your layouts to GoogleMock can greatly benefit your ongoing testing costs.

If this is a reason to consider the port, then remember that Googlemock can work with other test environments - not just Googletest. (NOTE: I did not use this feature, but saw its online reports)

0
source

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


All Articles