[Qt-creator] Unit testing private parts of shared libraries

timur.kristof at gmail.com timur.kristof at gmail.com
Tue Oct 17 19:46:33 CEST 2017


> > > > There is another way, and it's used in qbs I believe, that is
> > > > option 2:
> > > > #include "Foo.h"
> > > > #include "Foo.cpp"
> > > > 
> > > > class FooTest: QObject
> > > > {
> > > > ...
> > > > }
> > > > 
> > > 
> > > The downside I guess that again, you're not testing the code
> > > exactly
> > > as shipped and that compilation times go up a bit.
> > 
> > What do you mean by "not testing the code exactly as shipped"? When
> > you include the cpp file (or just compile the same file into your
> > project), why isn't it the same code as shipped?
> > Sorry for my ignorance.
> 
> I was talking about the compiled code. My bad for not being cleared.
> So what I meant with "as shipped" was "exactly the shared library
> file
> that will be part of the product".

Well, you can make sure of that by using the exact same build
environment and compiler flags for your tests as your library. This way
it will be the exact same compiled code, won't it?

- Timur



More information about the Qt-creator mailing list