Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Multiple pro file project with QTests

Multiple pro file project with QTests

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 119 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Creatorczyk
    wrote on last edited by
    #1

    Hi,

    I would like to add tests in my project, so that when compiling and running the main program, the tests are also run. I found a project on github that show how to do it using the main pro file and other pro files in subdirectories. Unfortunately, the tests are not performed when starting the program. How could I make the tests run before starting the program, or make then the application is build?

    Code on github:
    https://github.com/vivaladav/BitsOfBytes/tree/master/gui-unit-testing-with-qt-test-advanced/GuiUnitTestingAdv

    main .pro file:

    TEMPLATE = subdirs
    
    SUBDIRS += \
        WidgetsLib \
        TesterPanelConcat \
        ExampleApp
    
    lib.subdirs = WidgetsLib
    tests.subdirs = TesterPanelConcat
    app.subdirs = ExampleApp
    
    app.depends = lib
    tests.depends = lib
    

    other .pro file 1:

    QT       += widgets
    
    TARGET = WidgetsLib
    TEMPLATE = lib
    
    DEFINES += WIDGETSLIB_LIBRARY
    
    DEFINES += QT_DEPRECATED_WARNINGS
    
    SOURCES += \
        PanelConcat.cpp
    
    HEADERS += \
        PanelConcat.h \
        WidgetsLibGlobal.h
    
    unix {
        target.path = /usr/lib
        INSTALLS += target
    }
    

    other .pro file 2:

    QT       += widgets testlib
    
    TARGET = TestPanelConcat
    CONFIG   += console
    CONFIG   -= app_bundle
    
    TEMPLATE = app
    
    DEFINES += QT_DEPRECATED_WARNINGS
    
    INCLUDEPATH += \
    				../WidgetsLib
    
    LIBS += \
    		-L../WidgetsLib \
    		-lWidgetsLib
    
    SOURCES += \
            TestPanelConcat.cpp 
    
    DEFINES += SRCDIR=\\\"$$PWD/\\\"
    

    other .pro file 3:

    QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = ExampleApp
    TEMPLATE = app
    
    DEFINES += QT_DEPRECATED_WARNINGS
    
    INCLUDEPATH += \
    				../WidgetsLib
    
    LIBS += \
    		-L../WidgetsLib \
    		-lWidgetsLib
    
    SOURCES += \
            main.cpp \
            MainWindow.cpp
    
    HEADERS += \
            MainWindow.h
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved