mardi 2 mars 2021

Maven Surefire: (Re-)Loading classes for isolated testing in forks

I would like to configure Maven Surefire to always fork a new JVM process for each test and reload all .class files that are necessary within that test inside that newly forked process. I thought this was realizable with forkCount=1 and reuseForks=false (for maximal isolation of tests), but this does not work, as tests (i.e., JVM forks) will not reload a .class file if it has already been loaded by a previously run test.

I've tried using the isolated class loader rather than the system class loader, but that did not affect this problem. Right now I'm starting my test execution like this: mvn test -DfailIfNoTests=false -Dmaven.test.failure.ignore=true -DforkCount=1 -DreuseForks=false -f PATH_TO_PROJECT.

I would really appreciate some help. Thank you.

Aucun commentaire:

Enregistrer un commentaire