println doesn't work when running ScalaTest

8,986 views
Skip to first unread message

Todd O'Bryan

unread,
Apr 14, 2012, 12:31:04 PM4/14/12
to simple-build-tool
When I run >test or >test-only from SBT, I get the output from
ScalaTest showing me which tests passed and failed, but I put a couple
of println statements in a failing test, and the output doesn't show
up.

Is there any way to get it to show up, or where would I find it. If
the answer is "the sbt log," can you be specific about where that is.
I look for it and didn't find it right off.

Thanks!
Todd

Konrad Malawski

unread,
Apr 14, 2012, 1:05:34 PM4/14/12
to simple-b...@googlegroups.com
Hi Todd,
you can call info(String)inside any Spec. It will then show up under the messages displayed by the reporter (in the same way as if you used with GivenWhenThen and then given(String) in your code for example :-))

I hope this helps :-)
--  
Cheers,
Konrad Malawski
java.pl - Polish Java User Group
softwaremill.pl - SoftwareMill
blog.project13.pl - Private Blog



2012/4/14 Todd O'Bryan <toddo...@gmail.com>
Todd

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To post to this group, send email to simple-b...@googlegroups.com.
To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.


Mark Harrah

unread,
Apr 14, 2012, 1:27:26 PM4/14/12
to simple-b...@googlegroups.com
On Sat, 14 Apr 2012 19:05:34 +0200
Konrad Malawski <konrad....@project13.pl> wrote:

> Hi Todd,
> you can call info(String)inside any Spec. It will then show up under the
> messages displayed by the reporter (in the same way as if you used with
> GivenWhenThen and then given(String) in your code for example :-))

This is good to know. I don't know why println doesn't show up, though. Some possible explanations are some different binding for println (you could check if System.out.println works) or System.out being redirected (sbt doesn't ever do this itself).

-Mark

Konrad Malawski

unread,
Apr 14, 2012, 1:38:12 PM4/14/12
to simple-b...@googlegroups.com
My guess is that maybe Todd expects it to show up where the scalatest test repors is (after the text of an it(...)), 
but actually those are printed a lot later than the code is actually run. Look for the println / logger messages a bit higher up in the console output, Todd :-)

If it ain't there, then I'm out of ideas, "works for me" isn't a good answer to give you I guess... :-)
(You could also try a logger instead of just plain println if the problem persists).

-- 
Konrad Malawski



2012/4/14 Mark Harrah <dmha...@gmail.com>
Reply all
Reply to author
Forward
0 new messages