pro icon indicating copy to clipboard operation
pro copied to clipboard

Extract launcher core out of tester plugin

Open sormuras opened this issue 7 years ago • 6 comments

I'd like to extract the core functionality from the tester-plugin into a standalone module living on "central". This new module could be used by any framework, including pro, that needs to launch the JUnit Platform in a modular testing environment.

Types to be extracted

From package: https://github.com/forax/pro/blob/master/plugins/tester/src/main/java/com.github.forax.pro.plugin.tester/com/github/forax/pro/plugin/tester/

  • TestConf.java -- holding the test setup configuration fixture ... story
  • TesterRunner.java -- launching the test run for a given instance of TestConf
  • parts of TesterPlugin.java -- doing bootstrap work creating module layer, class loaders, etc... like:

https://github.com/forax/pro/blob/cae819eeb0e63b81045c8461742314e9cec7b6bb/plugins/tester/src/main/java/com.github.forax.pro.plugin.tester/com/github/forax/pro/plugin/tester/TesterPlugin.java#L86-L100

What do you think, @forax?

sormuras avatar Aug 21 '18 15:08 sormuras

This can not be a part of JUnit ?

forax avatar Aug 23 '18 17:08 forax

Good idea. Should work ... but would require --release 9 or higher, thus turn junit-platform-launcher into a mrjar, or it lands in a dedicated JUnit Platform project.

@junit-team What do you think?

sormuras avatar Aug 23 '18 17:08 sormuras

Started project junit-platform-isolator https://github.com/sormuras/junit-platform-isolator -- it cares for isolating main, test, and platform classes at test runtime. After it has reached 1.0 GA statues, pro's tester plugin could use that library and prune the launcher code here.

Isolator

https://github.com/sormuras/junit-platform-isolator/blob/master/junit-platform-isolator-base-8/src/main/java/de/sormuras/junit/platform/isolator/Isolator.java#L65-L70

Module Loader

https://github.com/sormuras/junit-platform-isolator/blob/master/junit-platform-isolator-java-11/src/main/java/de/sormuras/junit/platform/isolator/OverlaySingleton.java#L16-L25

Runner/Worker

https://github.com/sormuras/junit-platform-isolator/tree/master/junit-platform-isolator-worker/src/main/java/de/sormuras/junit/platform/isolator/worker

Note

The first client of junit-platform-isolator is the JUnit Platform Maven Plugin: https://github.com/sormuras/junit-platform-maven-plugin

sormuras avatar Dec 16 '18 15:12 sormuras

This can not be a part of JUnit?

With https://github.com/junit-team/junit5/issues/797 being implemented and shipping soon with JUnit Platform 1.6.x ... pro/tester (and other test run launching programs) may use this java.util.spi.ToolProvider entry-point to launch a test run. Inputs are two printer writer (or streams) for expected/normal and error output and an array of arguments. A run yields an integer exit code.

sormuras avatar Oct 03 '19 13:10 sormuras

As of today, JUnit Platform 1.6.0 is GA.

Use junit as a provided tool?

sormuras avatar Jan 20 '20 21:01 sormuras

yes, go for it !

forax avatar Jan 20 '20 22:01 forax