Bug 540135 - [JUnit 5] Support test source URI for dynamic nodes
Summary: [JUnit 5] Support test source URI for dynamic nodes
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.10   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks: 536354
  Show dependency tree
 
Reported: 2018-10-15 07:45 EDT by Noopur Gupta CLA
Modified: 2021-08-29 03:44 EDT (History)
3 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-10-15 07:45:28 EDT
See JUnit Jupiter release notes for JUnit 5.3.0 in https://junit.org/junit5/docs/current/release-notes/index.html#release-notes:

New support for supplying a custom test source URI when creating a dynamic container or test.

A custom test source URI for a dynamic container or dynamic test will be registered as a ClasspathResourceSource if the URI uses the classpath scheme; otherwise, such a URI will be registered as a FileSource, DirectorySource, or UriSource as appropriate.

See the new factory methods dynamicContainer(String, URI, …) in DynamicContainer and dynamicTest(String, URI, Executable) in DynamicTest for details.

-----

One example:

class T {
	 @TestFactory
	  Stream<DynamicTest> testFiles() throws Exception {
			return Files.walk(Paths.get("C:\\Eclipse\\Workspaces\\master1\\Demo\\test"), 1)
	        .map(path -> dynamicTest(
	                path.getFileName().toString(),
	                path.toUri(),
	                () -> System.out.println(path)));
	  }
}

-----

Support required:

- "Go to File" or double-click action on a uri test node in JUnit view should navigate/open to the corresponding file, if possible.

- Re-running a specific uri test node from JUnit view should work.
Comment 1 Johannes Zillmann CLA 2021-08-29 03:44:18 EDT
That would be awesome to have!