3

Say you have a C++ class B derived of class A. You have extensive tests set up for class A that you would also 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.

2
  • This question is very similar - might be useful to you. Commented Apr 20, 2011 at 9:43
  • Base/derived (prefered), parent/child or super-/sub- class. Pick one pair! Commented Apr 20, 2011 at 9:46

1 Answer 1

2

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).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.