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

Investigate more extensible solution for test resolution #29

Closed
marcphilipp opened this issue Dec 2, 2015 · 14 comments
Closed

Investigate more extensible solution for test resolution #29

marcphilipp opened this issue Dec 2, 2015 · 14 comments

Comments

@marcphilipp
Copy link
Member

No description provided.

@marcphilipp marcphilipp added this to the Alpha M1 milestone Dec 2, 2015
bechte added a commit that referenced this issue Dec 3, 2015
- discoveryTests now returns the root testDescriptor and does not take and EngineDescriptor as argument
- TestPlan holds a mapping for the engines and their corresponding root test descriptor
bechte added a commit that referenced this issue Dec 3, 2015
- discoveryTests now returns the root testDescriptor and does not take and EngineDescriptor as argument
- TestPlan holds a mapping for the engines and their corresponding root test descriptor
@schauder
Copy link
Contributor

schauder commented Dec 5, 2015

I wrote a mail to the mailing list last week, which among other things touched on the test resolution & execution process.

To which @bechte replied (https://groups.yahoo.com/neo/groups/junit/conversations/messages/24734)

The concept of a test engine covers both, lookup and execute tests. The core framework is not supposed to execute the tests itself, because a test engine could provide very specific test behavior, e.g. running cucumber tests, requiring a very specific execution path. Therefore, we decided that the engine is responsible for both. In case of the JUnit5TestEngine, we will provide extension points that can be used by extension providers to hook into the standard „Java testing“ test run circle. We are still working on this extension model, therefore, there is not much within the code, yet. Please be patient about this feature. I hope that we are able to provide it within the next iteration, too.

I still think that executing the tests should be done by some internal Java component, not some pluggable mechanism like a TestEngine.

Tools like IDEs will very soon rely heavily on the correct events/information delivered through some kind of listener API. If the TestEngines have to do this, because they are executing the tests, this will be broken for many TestEngines to come. But if it has to be the same all the time, it should be implemented only once.

I like the Cucumber example. I fully agree that it should be possible to execute write an Engine that registers tests as Cucumber does. And there is some challenging work in this, to find the right abstraction (like: What exactly is a Test, and do we need some Granularity above and below Tests.) But this needs to be represented in a TestSpecifcation, so JUnit can properly report on it. And in the end a Test just gets executed, succeeds, fails or gets skipped, there is not much any Engine can or should change about that.

And if TestEngine actually needs itself for the execution, there is no problem in having a Statement (using the Term from JUnit4 Rules) to reference and use the TestEngine it was created by.

Keep up the good work.

@jlink
Copy link
Contributor

jlink commented Dec 6, 2015

If I understand you right you'd prefer something along the following:

interface  ContainerDescriptor extends TestDescriptor {
    Executable beforeAll();
    Executable afterAll();
}

interface LeafDescriptor extends TestDescriptor {
    Executable runTest();
}

Then the launcher could execute the tests and make sure that the correct invocation of test execution events takes places.

Well worth a consideration IMO.

@schauder
Copy link
Contributor

schauder commented Dec 6, 2015

Yes.

@jlink
Copy link
Contributor

jlink commented Dec 6, 2015

Additional complexity: For discovery engines must be given an object / lambda with which they can do things like create dynamic tests, forward additional test data and like during test execution later.

I still think we should consider this approach and see if all types of engines that we think of would fit into such a model.

@jlink
Copy link
Contributor

jlink commented Dec 7, 2015

After some discussion with Marc (he did some concrete experimentation that suggests that parallelization would be a piece of cake with this approach) we feel the need to hand down stuff from a container to a child. This could be done via generics, for example instead of MutableTestDescriptor we could have two interfaces along those lines:

public interface ParentTestDescriptor<T> extends TestDescriptor {
    @Override
    Set<ChildTestDescriptor<T>> getChildren();
    void addChild(ChildTestDescriptor<T> descriptor);
    void removeChild(ChildTestDescriptor<T> descriptor);
    Callable<T> beforeAll();
    Consumer<Throwable> afterAll();
}

public interface ChildTestDescriptor<T> extends TestDescriptor {
    @Override
    Optional<ParentTestDescriptor<T>> getParent();
    void setParent(ParentTestDescriptor<T> parent);
    Consumer<T> runTest();
}

A specific engine could then implement type-safe classes. Intermediate containers would implement both interfaces, e.g. a nested test is both child and parent.

@marcphilipp
Copy link
Member Author

I've just looked into JUnit 4 again. As much as I like the approach suggested here, I don't see how we could implement the JUnit 4 engine with it. 😢

@jlink
Copy link
Contributor

jlink commented Dec 7, 2015

I have an idea; maybe we can have two different flavours of engines. Let's
talk about it 2morrow.

2015-12-07 19:55 GMT+01:00 Marc Philipp notifications@github.com:

I've just looked into JUnit 4 again. As much as I like the approach
suggested here, I don't see how we could implement the JUnit 4 engine with
it. [image: 😢]


Reply to this email directly or view it on GitHub
#29 (comment)
.

@schauder
Copy link
Contributor

schauder commented Dec 8, 2015

I would like to understand what the problem is with JUnit 4 and this approach.

bechte added a commit that referenced this issue Dec 9, 2015
bechte added a commit that referenced this issue Dec 9, 2015
bechte added a commit that referenced this issue Dec 9, 2015
bechte added a commit that referenced this issue Dec 9, 2015
bechte added a commit that referenced this issue Dec 9, 2015
bechte added a commit that referenced this issue Dec 9, 2015
bechte added a commit that referenced this issue Dec 9, 2015
bechte added a commit that referenced this issue Dec 9, 2015
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
synyx GmbH & Co. KG (http://www.synyx.de) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
…resolving for the resolved tests #29

------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
synyx GmbH & Co. KG (http://www.synyx.de) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
synyx GmbH & Co. KG (http://www.synyx.de) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
…resolving #29

------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
…claring class #29

------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
…#29

------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
…all TestResolverRegistry.notifyResolvers, instead of returning a resolver result. This allows more flexibility and empowers the resolvers to work incorporately. #29

------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks
AdNovum Informatik AG (http://www.adnovum.ch) for supporting the
JUnit crowdfunding campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks msg systems ag
(http://www.msg-systems.com) for supporting the JUnit crowdfunding
campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks msg systems ag
(http://www.msg-systems.com) for supporting the JUnit crowdfunding
campaign!
------------------------------------------------------------------------
bechte added a commit that referenced this issue Jan 6, 2016
------------------------------------------------------------------------
On behalf of the community, the JUnit Lambda Team thanks msg systems ag
(http://www.msg-systems.com) for supporting the JUnit crowdfunding
campaign!
------------------------------------------------------------------------
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants