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

Show parameter in Maven's report of failed parameterized tests #1111

Closed
ogregoire opened this issue Oct 16, 2017 · 4 comments
Closed

Show parameter in Maven's report of failed parameterized tests #1111

ogregoire opened this issue Oct 16, 2017 · 4 comments

Comments

@ogregoire
Copy link

ogregoire commented Oct 16, 2017

Overview

  • ( ) Feature request. When I'm writing parameterized tests, I'd expect Junit to tell me which parameterized test failed.

For instance, the following code should tell me that it's "def" that's failing.

  @ParameterizedTest
  @ValueSource(strings = {"abc", "def"})
  void doSomeTest(String str) {
    assertTrue("abc".equals(str));
  }

Here's its output:

Running hello.MyTest
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.123 sec <<< FAILURE! - in hello.MyTest
doSomeTest(String)  Time elapsed: 0.013 sec  <<< FAILURE!
org.opentest4j.AssertionFailedError: 
	at hello.MyTest.doSomeTest(MyTest.java:54)


Results :

Failed tests: 
doSomeTest(String).doSomeTest(String)
  Run 1: PASS
  Run 2: MyTest.doSomeTest:54

I would expect the failed tests to show which parameters were given to the failing test.

Additionally, the "failed tests" list mentions doSomeTest(String).doSomeTest(String), shouldn't it be hello.MyTest.doSomeTest(String)?

The final output should be:

Results :

Failed tests: 
hello.MyTest.doSomeTest(String)
  Run 1 ("abc"): PASS
  Run 2 ("def"): MyTest.doSomeTest:54

Here's a repository showcasing the issue: junit5-issue1111

@sormuras
Copy link
Member

Which tool do you use to execute your tests?

If you execute them via the console launcher or within an IDE, you get what you expect.

@ogregoire
Copy link
Author

I'm using Maven. Good ol' plain Maven.

@luolong
Copy link

luolong commented Oct 20, 2017

Yeah. Maven reporter needs some love ...

@ogregoire ogregoire changed the title Show parameter in failed parameterized tests Show parameter in Maven's report of failed parameterized tests Oct 20, 2017
@marcphilipp
Copy link
Member

The root cause is that Surefire does not support non-technical display names. I'm therefore closing this issue as duplicate of #990.

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