Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 542742 - [JUnit 5] Avoid calling Launcher#discover
Summary: [JUnit 5] Avoid calling Launcher#discover
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.10   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.11 M3   Edit
Assignee: Noopur Gupta CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 543821
Blocks:
  Show dependency tree
 
Reported: 2018-12-13 05:30 EST by Noopur Gupta CLA
Modified: 2019-12-21 09:33 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Noopur Gupta CLA 2018-12-13 05:30:40 EST
Eclipse calls Launcher#discover first (for all discovery requests) to collect the discovered test plans which are used to count the total number of tests and create the test tree.

After that, Launcher#execute is called which notifies the corresponding TestExecutionListeners and the test tree is updated.

The implementation is based on the Javadoc of Launcher:
Clients of this interface may optionally call discover prior to execute in order to inspect the TestPlan before executing it. 

This sequence of steps in Eclipse is common for JUnit 4 also.
Comment 1 Noopur Gupta CLA 2018-12-13 05:44:15 EST
Based on JUnit 5 issue https://github.com/junit-team/junit5/issues/1695, Launcher#discover should be avoided as Launcher#execute performs discovery once again which can result in performance problems.

The proposed solution on the GitHub issue doesn't look straightforward for Eclipse due to its current implementation. It would have been easier to have the Launcher#execute(TestPlan) method with a disclaimer to the clients to not modify the TestPlan before calling #execute(TestPlan).
Comment 2 Noopur Gupta CLA 2018-12-13 05:44:41 EST
I will investigate further and update the bug.
Comment 3 Noopur Gupta CLA 2018-12-21 06:16:39 EST
(In reply to Noopur Gupta from comment #2)
> I will investigate further and update the bug.
Provided feedback via https://github.com/junit-team/junit5/issues/1695#issuecomment-448989093.
Comment 4 Eclipse Genie CLA 2019-02-15 07:05:19 EST
New Gerrit change created: https://git.eclipse.org/r/137000