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

Surefire-1701: Fix @DisplayName breaking reruns #249

Merged
merged 1 commit into from
Oct 28, 2019
Merged

Surefire-1701: Fix @DisplayName breaking reruns #249

merged 1 commit into from
Oct 28, 2019

Conversation

Col-E
Copy link
Contributor

@Col-E Col-E commented Oct 22, 2019

As discussed in Surefire-1584 there was a bug where @DisplayName would break rerun logic. This PR resolves both this bug and addresses another potential issue (No triggering sample found though) where the adapter was treated as if it were stateless, but it is stateful.

The platform provider unit test has been updated with @DisplayName usages to verify the correctness of this solution.

{
// Extract quantified test name data
String[] classMethodName = adapter.toClassMethodNameWithoutPlan( identifier );
String className = classMethodName[1];
String methodName = classMethodName[3];
String className = classMethodName[0];
Copy link
Contributor

@Tibor17 Tibor17 Oct 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be worth to use OOP and not string array because now I can see how it is difficult to understand the indexes of the array and their meaning. So we have a couple of class + method, and one group is the traditional and second is named. So the class can have annotation as well.

Copy link
Contributor Author

@Col-E Col-E Oct 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but I do not think that is within the scope of this PR (A simple bug fix).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, right, we can do it after this PR. And we do not need to have Jira issue for a small internal code improvement.

@@ -865,6 +866,7 @@ void testAlwaysSkipped()
throw new IllegalStateException( "this test should be never called" );
}

@org.junit.jupiter.api.DisplayName( "Fails twice" )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, okay it cover the test scenario but since we made two changes (array indexes and added HashSet) we should assert the display names in the listener too.

What if we coment the DisplayName? It will not rerun the tests as we found it in Jira?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we coment the DisplayName? It will not rerun the tests as we found it in Jira?

I'm not sure I follow. I've updated the test to print the failing test names if that's what you're looking for.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant something like this 4f16fcd#diff-183e6d2cde226a9744aa928c54694b2fR239 in the tests for this bug.

Copy link
Contributor

@Tibor17 Tibor17 Oct 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you have already added these assertion statements for handled display names in the latest commit. :-)

for ( TestExecutionSummary.Failure failure : summary.getFailures() )
failDisplays.add( failure.getTestIdentifier().getDisplayName() );
assertEquals( 3, failDisplays.size() );
assertTrue( failDisplays.contains( "Fails twice" ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…sses/methods for test reruns

Fix test formatting

Fix test formatting 2

a

fix test

c
@Tibor17
Copy link
Contributor

Tibor17 commented Oct 28, 2019

@Tibor17 Tibor17 merged commit c391947 into apache:master Oct 28, 2019
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

Successfully merging this pull request may close these issues.

2 participants