Impossible to tell what line caused test failure #41

Closed
benmccann opened this Issue Jan 15, 2014 · 5 comments

2 participants

@benmccann

The test failure messages are very frustrating because they don't include line numbers:

[error] Test com.benmccann.StringUtilTest.myTest failed: null
[info] com.benmccann.StringUtilTest
[info] x myTest

That makes it impossible to tell which line of this test failed:

@Test
public void myTest() throws Exception {
  Assert.assertTrue(MyClass.doSomething(1));
  Assert.assertTrue(MyClass.doSomething(2));
  Assert.assertTrue(MyClass.doSomething(3));
  Assert.assertTrue(MyClass.doSomething(4));
}
@szeiger

You need to use -a to get stack traces for assertions

@benmccann

I'm really hoping we could just add line numbers. A stack trace is way more than I'd want in most cases

@szeiger

The stack trace is the safest choice. If you wanted to print a single location you'd have to determine where the failing assertion really is recognizing all wrappers around the code that throws the exception

@benmccann

If I do "test -a" in play then I get the following:

[myproject] $ test -a
[error] Expected ID character
[error] Not a valid command: test (similar: set, last, exit)
[error] Expected project ID
[error] Expected configuration
[error] Expected ':' (if selecting a configuration)
[error] Expected key
[error] Expected '::'
[error] Expected end of input.
[error] test -a

-a doesn't appear to work with testOnly. If I try then it just skips all the tests and says there were no tests to run. I'm not sure if that's a bug or if -a is meant only to work when running all tests, but it would be really nice to have the stack trace when running a single test

@benmccann benmccann referenced this issue in playframework/playframework Mar 22, 2014
Merged

Impossible to tell what line cause test failure #2517

@benmccann

Turns out this one was a bug in play. Closing it here since it's being fixed in play. Thanks for the help!

@benmccann benmccann closed this Mar 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment