-
Notifications
You must be signed in to change notification settings - Fork 917
Support JUnit5 nested test classes #3995
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -778,6 +778,13 @@ private void generateTest() { | |
| } | ||
| } | ||
|
|
||
| String classname = testcase.getAttributeValue("classname"); | ||
| // keep the embedded class in classnames and add to display name | ||
| int suiteNameLength = suite.getName().length(); | ||
| if (classname.length() > suiteNameLength && classname.startsWith(suite.getName())) { | ||
| displayName = classname.substring(suiteNameLength) + "." + methodName; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: when is this code path executed ? I have tried running the whole testsuite, and a single method within a nested class, but did not hit the branch. I am asking bcs it seems as there should be '.' or '$' at
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you tried using the class MyClassTest {
@Nested
class NestedGroupTest {
@Test
public void mytest() {...}
}
}
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| Testcase test = new JUnitTestcase(methodName, displayName, testType, session); | ||
| Element stdout = testcase.getChild("system-out"); //NOI18N | ||
| // If *-output.txt file exists do not log standard output here to avoid logging it twice. | ||
|
|
@@ -811,7 +818,6 @@ private void generateTest() { | |
| float fl = NumberFormat.getNumberInstance(Locale.ENGLISH).parse(time).floatValue(); | ||
| test.setTimeMillis((long)(fl * 1000)); | ||
| } | ||
| String classname = testcase.getAttributeValue("classname"); | ||
| if (classname != null) { | ||
| //#204480 | ||
| if (classname.endsWith(nameSuffix)) { | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: there may be multiple toplevel classes in a file: how is the
SingleMethodsupposed to capture that ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. How is it done today?