Formatted color output when running ScalaTest via sbt

357 views
Skip to first unread message

Bill Venners

unread,
Aug 21, 2010, 3:26:26 AM8/21/10
to scalate...@googlegroups.com, simple-b...@googlegroups.com
Hi All,

I've deployed a ScalaTest branch that gives the nicely formatted,
color output from sbt that you can get from the command line. The
branch is here:

http://www.scala-tools.org/repo-snapshots/org/scalatest/scalatest/1.2.1-SNAPSHOT/

You can use the following code in your sbt project file to get it:

val scalaToolsSnapshots = ScalaToolsSnapshots
val scalatest = "org.scalatest" % "scalatest" % "1.2.1-SNAPSHOT"

You can configure the output in three ways: 1) turn off color, 2) show
full stack traces, and 3) show durations for everything. To do that
you need to add:

override def testOptions = super.testOptions ++
Seq(TestArgument(TestFrameworks.ScalaTest, "-oD"))

D - show durations
F - show full stack traces
W - without color

So "-oDF" would show complete stack traces and durations (the amount
of time spent in each test).

Please let me know if you have any trouble with it.

Thanks.

Bill
----
Bill Venners
Artima, Inc.
http://www.artima.com

Anton Beloglazov

unread,
Oct 2, 2010, 1:48:34 AM10/2/10
to scalatest-users
Hi Bill,

First of all, thank you for the great work!

I'm not sure if this is the right place to ask, but my problem is the
following. I'm trying to run specs test with the 1.2.1-SNAPSHOT
ScalaTest and SBT as explained here
http://code.google.com/p/specs/wiki/RunningSpecs#Run_your_specification_with_Scala_Test

I have added the ScalaTest trait to my specification, and my project
setup in SBT is:

val specs = "org.scala-tools.testing" % "specs_2.8.0" % "1.6.5"
val scalaToolsSnapshots = ScalaToolsSnapshots
val scalatest = "org.scalatest" % "scalatest" % "1.2.1-SNAPSHOT"
override def testOptions = super.testOptions ++
Seq(TestArgument(TestFrameworks.ScalaTest, "-oDF"))

When I run the test command, SBT actually runs tests with both specs
and ScalaTest runners. However, the output from ScalaTest is not
colored and durations are not shown. I'm not sure what is the reason,
is it because SBT doesn't use the snapshot of ScalaTest? Or the test
options are not passed in? Is it possible to have a colored output in
the Windows console?

Thank you,
Anton

On Aug 21, 12:26 pm, Bill Venners <b...@artima.com> wrote:
> Hi All,
>
> I've deployed a ScalaTest branch that gives the nicely formatted,
> color output from sbt that you can get from the command line. The
> branch is here:
>
> http://www.scala-tools.org/repo-snapshots/org/scalatest/scalatest/1.2...

Bill Venners

unread,
Oct 2, 2010, 2:17:36 AM10/2/10
to scalate...@googlegroups.com
Hi Anton,

I don't know what's going on, but if it was using 1.2.1-SNAPSHOT it
should come out in color by default. Perhaps specs has a dependency on
an older version of ScalaTest that's getting used?

Bill

> --
> You received this message because you are subscribed to the Google
> Groups "scalatest-users" group.
> To post to this group, send email to scalate...@googlegroups.com
> To unsubscribe from this group, send email to
> scalatest-use...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/scalatest-users?hl=en
> ScalaTest itself, and documentation, is available here:
> http://www.artima.com/scalatest
>

--

Anton Beloglazov

unread,
Oct 2, 2010, 5:30:50 AM10/2/10
to scalatest-users
Bill,

Thank you for the quick reply! I've tried to convert my tests to
ScalaTest and run them in SBT using the snapshot version of ScalaTest.
It works and the durations are shown; however, the output is still not
colored. Is it because I'm using Windows' console?

Thanks,
Anton

On Oct 2, 11:17 am, Bill Venners <b...@artima.com> wrote:
> Hi Anton,
>
> I don't know what's going on, but if it was using 1.2.1-SNAPSHOT it
> should come out in color by default. Perhaps specs has a dependency on
> an older version of ScalaTest that's getting used?
>
> Bill
>
> On Fri, Oct 1, 2010 at 10:48 PM, Anton Beloglazov
>
>
>
>
>
> <anton.belogla...@gmail.com> wrote:
> > Hi Bill,
>
> > First of all, thank you for the great work!
>
> > I'm not sure if this is the right place to ask, but my problem is the
> > following. I'm trying to run specs test with the 1.2.1-SNAPSHOT
> > ScalaTest and SBT as explained here
> >http://code.google.com/p/specs/wiki/RunningSpecs#Run_your_specificati...
Reply all
Reply to author
Forward
0 new messages