开发者

Applying tests for superclass on derived class

开发者 https://www.devze.com 2023-02-28 02:25 出处:网络
Say you have a C++ class B derived of class A. You have extensive tests set up for class A that you would als开发者_如何学Pythono like to run over instances of class B, as it should fully support A\'s

Say you have a C++ class B derived of class A. You have extensive tests set up for class A that you would als开发者_如何学Pythono like to run over instances of class B, as it should fully support A's functionality. Of course you also have additional B specific tests.

How would you setup the tests so that you don't have to duplicate all of A's tests for B?

A specific answer for Google Test would be great.


Use Typed Tests (if you know in advance which types you want to test) or Type-Parameterized Tests (if you want to decouple fixture creation from test logic).

0

精彩评论

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