Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4068818
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:25:20+00:00 2026-05-20T16:25:20+00:00

I am using Qt Creator with qmake to create my project and my test

  • 0

I am using Qt Creator with qmake to create my project and my test project (QTest-tests). I have the test project running on its own now, but I have a hard time to understand how to test classes from my normal project. I can include the .h files from my project in the test cases, but that’s of course not enough.

It throws my linker errors since it does have not the code or a library to look up the code for the class. Is there a simple way to tell qmake to look up all source files in a specific folder to load them? Or what is the correct way to set up such a test project without having to add each source file also to the test project or compiling your application into an library to include?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:25:20+00:00Added an answer on May 20, 2026 at 4:25 pm

    Is there a simple way to tell QMake to look up all source files in a specific folder to load them?

    qmake supports wildcards so you can have something like

    SOURCES += *.cpp
    HEADERS += *.h
    

    in your project file.

    Also make sure to adjust MOC_DIR and RCC_DIR to point somewhere else than the source folder. You don’t want to include generated source files in your SOURCES.

    Or what is the correct way to set up such an test project without having to add each source file also to the test project or compiling your app into an lib to include

    I prefer to separate my automated tests into two classes:

    • Unit tests testing single components (usually living in a source file). I mock away dependencies to other parts of the system. Each unit test is a Qt project of its own and only includes the source files being tested + test code + mock code.

    • Integration tests testing components as whole without mock code. Usually it’s the application engine part built as a library and then linked to the test project.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Qt Creator and have a Qt GUI project that depends on
In order to keep my Qt project somewhat organized (using Qt Creator), I've got
I have been using Qt creator to make applications using the Qt libraries. I
I'm new to Qt and have been designing forms using Qt Creator. I've noticed
I have a project that uses SystemConfiguration.Framework. I've been using xcode, where adding the
Using online interfaces to a version control system is a nice way to have
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using JDeveloper , I started developing a set of web pages for a project
I'm using a stylesheet in my Qt desktop application (a .qss file), but I
I'm using SFML, and I want to use Qt Creator in conjunction with it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.