Skip to content

feat: Allow java apps to use cds-test#14

Draft
BobdenOs wants to merge 7 commits intocap-js:mainfrom
BobdenOs:feat/java
Draft

feat: Allow java apps to use cds-test#14
BobdenOs wants to merge 7 commits intocap-js:mainfrom
BobdenOs:feat/java

Conversation

@BobdenOs
Copy link
Contributor

This PR uses the default cds.env.profiles behavior to detect whether the application is an java application. If this is the case it trigger the default mvn command to start the application on a random port. Once the server is responsive the db service and the axios url are adjusted accordingly to have the test communicate to the java application instead of an internal node server.

When the tests want to run the java application inside node it is possible to provide the node profile and the java profile will be ignored (e.g. CDS_ENV=node npm t).

@chgeo chgeo marked this pull request as draft March 14, 2025 10:13
@sjvans sjvans requested review from chgeo and danjoa December 19, 2025 08:23
Copy link
Member

@chgeo chgeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!
But I wonder how such Java tests will be invoked? Certainly not with cds.test() from Java code, right?
So what is the way developers would use that?

@stefanrudi
Copy link

@chgeo I think the advantage of this is that if you already have integration tests written in Jest and you want to validate the same logic for Java, you don't have to write the exact same tests again in JUnit. So developers can simply run the same tests against a CAP Java sever instead a Node.js one.
I am currently using this to run our integration tests in change-tracking against a Java sample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants