How to test the code from application (as opposed to library)?

I'm trying to figure out how to do automated testing with the help of Qt Test . Since a test itself is an application (.exe on Windows), testing libraries is no problem - add proper INCLUDEPATH and LIBS to the project just as if linking any other application with this library. But how do I test the code that resides in the app-type project? You can't link an application to another application.

Do I have to directly include the source files being tested into the test project? This can be non-trivial - there may be many dependencies, including 3rd-party libraries.

@jsulm
Feature tests, I suppose. Or unit tests. There doesn't seem to be much difference in this context. Even when I'm unit-testing a single class or even single method, it still may require a lot of dependencies that I'm not keen on duplicating in the test.pro file (but I don't see any other way).

@Violet-Giraffe Yes, you add the source files which you want to test and mock as many dependencies as possible.
It is a good idea to do TDD - Test Driven Development. First write the tests which fails, then implement the actual functionality until the tests pass. This way you write code which can be tested more easily. Writing first the code and then the tests can be challanging.