Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract launcher core out of tester plugin #63

Open
sormuras opened this issue Aug 21, 2018 · 6 comments
Open

Extract launcher core out of tester plugin #63

sormuras opened this issue Aug 21, 2018 · 6 comments

Comments

@sormuras
Copy link
Collaborator

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:

var moduleDescriptor = moduleReference.descriptor();
var moduleName = moduleDescriptor.name();
var testPath = Paths.get(moduleReference.location().get());
var loader = createTestClassLoader(tester, testPath, moduleName);
var testConfClass = load(loader, TestConf.class);
var testConfTypes = new Class<?>[] {ModuleDescriptor.class, boolean.class, List.class, List.class};
var parallel = tester.parallel();
var includeTags = tester.includeTags().orElse(List.of());
var excludeTags = tester.excludeTags().orElse(List.of());
var testConf = create(testConfClass, testConfTypes, moduleDescriptor, parallel, includeTags, excludeTags);
var runnerClass = load(loader, TesterRunner.class);
var runnerTypes = new Class<?>[] {testConfClass};
var runner = (IntSupplier) create(runnerClass, runnerTypes, testConf);

What do you think, @forax?

@forax
Copy link
Owner

forax commented Aug 23, 2018

This can not be a part of JUnit ?

@sormuras
Copy link
Collaborator Author

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
Copy link
Collaborator Author

@sormuras
Copy link
Collaborator Author

sormuras commented Oct 3, 2019

This can not be a part of JUnit?

With junit-team/junit5#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
Copy link
Collaborator Author

sormuras commented Jan 20, 2020

As of today, JUnit Platform 1.6.0 is GA.

Use junit as a provided tool?

@forax
Copy link
Owner

forax commented Jan 20, 2020

yes, go for it !

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

No branches or pull requests

2 participants