QTestlib unit test project for accessing classes in the main project in QTCreator

I am using QT Creator and want to run my unit tests in a separate project. How to refer to classes in the main project from my test project?

+5
source share
1 answer

I understand this is an old question, but here are a few steps to make it easy:

  • Move most of your configuration from file main_project.proto file main_project.pri.
  • Use relative paths with respect to your * .pri or * .pro files, using the syntax $$PWD/path/to/filewhere your * .pri or * .pro file $$PWDis.
  • Include *.prifile withinclude($$PWD/main_project.pri)
  • test main_project.
  • test/test.pro include($$PWD/../main_project.pri), _.

, - .

, , , , test_suite, . , , common.pri test/common .

, script, , , ...

+2

All Articles