-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to run tests that depends on the source code (.cpp files from src) which has to be built as executable library? #347
Comments
If I am understanding you correctly, you want to run tests (I assume something like googletest) against an executable module? It is my understanding that while an executable can have unit tests, those unit tests won't have the object files compiled from the source of the executable module itself. You will need to create a second library module that includes the object files you want to test -- but then of course you can test those object files in the library build, making executable unit tests largely redundant. Of course, other types of tests outside of nar, like integration tests, are always possible. |
The way I usually do it is to add the executable source code as an additional test source directory using the Build Helper Maven Plugin. This means of course that the test-compile phase will rebuild everything but has the advantage of you being able to change compile options for the unit tests, e.g. add profiling options. |
Wouldn't the use of |
Hallo,
I have a problem when trying to run a test for my maven nar-plugin-project. Since the project must be built as executable library, my test cannot link to it, and if I tried to build shared (or static) together with executable, it would result in compiler error (use multithreading). Since this case is very hard to reproduce, could someone give me a hint how you usually wrote tests for an executable project?
Thank you.
The text was updated successfully, but these errors were encountered: