running systemtests in isolated java processes

Kevin Rushforth kevin.rushforth at oracle.com
Fri Mar 1 15:02:17 UTC 2024


Hi Johan,

FOr the systemTests project, the gradle test runner does run each test 
class in its own VM, as a result of the "forkEvery = 1" setting. As 
noted, gradle launches tests using a gradle test runner class as the 
main method, but there is still a 1 VM to 1 test class relationship.

We have a few tests that specifically test launching JavaFX 
applications, including testing classes that extend Application (with 
and without a main method), such as the ones in test.launchertest, but 
they do it by exec-ing a new Java process. Would that work for what you 
want to do?

Perhaps tangentially related to this, I spent some time a while ago 
looking at what it would take to use jtreg to run our tests. I was 
looking at jtreg's ability to run JUnit tests, but there is also a mode 
of jtreg to run standalone main program tests. That could provide a way 
to run test applications directly, although likely only for tests 
written with that in mind.

-- Kevin


On 3/1/2024 6:18 AM, Johan Vos wrote:
> Hi,
>
> We currently run systemtests using a gradle command, but that doesn't 
> start a clean Java process for the individual tests (which would be 
> very convenient as that allows us to inspect the process with VisualVM).
> We know the behavior of a JavaFX application can be different depending if
> 1. the mainClass is the class extending from Application
> 2. the mainClass is a wrapper class from e.g. Gradle or Maven.
>
> For system tests, I think it would be real handy to run them using the 
> first option, but I am not aware of an easy solution to make that work 
> with the current gradle setup. Or am I missing something obvious?
>
> Thanks,
>
> - Johan



More information about the openjfx-dev mailing list