开发者

How to migrate Cppunit tests into GoogleTest?

I have a bunch of module tests written in CPPun开发者_高级运维it with some mocks created by hand. I am looking for a way to migrate them to GoogleTest as smoothly as possible. Have you tried such an operation? What was the effort needed?


Google Test and Cppunit seem to share somewhat the same syntax for invoking tests but as I suspect have too much differences in that syntax.

I'm almost sure you can't somehow automate it and this operation would require rethinking and recompositioning of your tests to follow the Google Test semantics (if you use something specialized to create your mocks, then porting them to Google Mock would require even more effort, simply because Google Mock's approach is not the obvious one and is actually complicated).

I would say that you'd better rethink the following questions: "why do I need to port my tests", "what would be the benefit of this operation" and "do I really want to study a whole new testing framework and then rewrite all of my tests for some purpose".


It seems that you can use google test from another framework (cppunit, in your case): https://code.google.com/p/googletest/wiki/AdvancedGuide#Letting_Another_Testing_Framework_Drive


To some extent I agree with @Kotti. Automatic conversion will be non-trivial for the tests, so you'd need to consider whether the number of existing tests justify the effort.

I'm a huge fan of the Googlemock framework, and if you make a significant investment in manual mocking, then porting your mocks to Googlemock could have a huge benefit to your ongoing testing costs.

If this is the reason for considering the port, then remember that Googlemock can work with other test frameworks - not just Googletest. (NOTE: I have not used this feature, but have seen online reports its use)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜