vscode-java-test
vscode-java-test copied to clipboard
Question: how to run tests with properties from alternative pom file
I'm trying to run tests for a project which uses Arquillian integration test framework. The project has an alternative pom.xml
file (outside of the root dir of the project) which should be used when runninng tests via maven
mvn clean install -f testsuite/integration-arquillian/pom.xml
but when running tests from vscode, I get exceptions/errors that seem like I'm missing all the mandatory default properties that are defined in the pom files but are missing when running tests via vscode.
Would you have any pointers for me on how to setup Java test runner for vscode for a project like this? I'd appreciate any help!
The project I'm working with is keycloak and the pom with the (apparently ignored) properties is testsuite/integration-arquillian/tests/pom.xml.
Will the test configuration help you?
https://github.com/microsoft/vscode-java-test/wiki/Run-with-Configuration
Thanks for responding @jdneo!
I assume that if I'm able to reproduce 1:1 every needed property setting which the maven build does when running tests with a certain pom.xml
and maven profile within it, it probably would work inside test runner as well. But I'm not familiar if this is the way it is assumed to be done? That is, manually go through the pom.xml
and its sub-modules and create java.test.config
in project's settings.json
that reflects the settings found there?
Would this be done purely by inspecting the pom files, or would there be approaches that help with the conversion process?
Currently we have to do it manually. This for sure can be an enhancement.
Not sure how will other IDEs(Eclipse, IntelliJ) deal with this. Have you tried them?
Thank you @jdneo, now I know I'm not using test runner wrong! :)
Just for curiosity, I did downloaded IntelliJ and imported keycloak as maven based project. It did pick up the properties automatically from the pom files and passed them on command line when running unit test cases. There was 152 properties in the full command line, which was visible in the intellij run console. I guess similar list could be possibly exported somehow from mvn
execution to help the creating java.test.config
for vscode.
I will close this issue now. Thanks again!
This can be a good feature request. Let's keep it open.