sbt .12 & specs 1 - run only 1 example

39 views
Skip to first unread message

crankydillo

unread,
Dec 22, 2012, 9:06:39 AM12/22/12
to specs...@googlegroups.com
Hi,

I have a spec with a ton of examples in it.  A bunch of them are failing, and I need to handle them one at a time.  If I use the spec's -ex option from Maven, it works well, but is slow.  I really want to use this from sbt using its test-only command.

I have tried many things, none of which have worked.  This is what I thought would work:

> test-only MySpec -- -ns -ex "add two numbers"

Does anyone know how to run one 'test/example' at a time using SBT (I asked in their IRC channel, but received no help)?  Any help is greatly appreciated.

etorreborre

unread,
Dec 22, 2012, 6:43:19 PM12/22/12
to specs...@googlegroups.com
Hi,

Since specs accepts -ex as a command line argument, the following should work:

> test-only MySpec -- -ex add two numbers

Notice that I have removed the quotes because the argument for ex is a regular expression. Maybe that's why it wasn't working for you?

Eric.

PS: of course one other option is to switch to specs2 :-)

crankydillo

unread,
Dec 22, 2012, 6:46:51 PM12/22/12
to specs...@googlegroups.com
I would love to switch to spec2 in order to use the HTML report.  However, my quick attempt at doing so (switch to mutable specs2) failed.

I will try again without the quotes, but I'm pretty sure I've tried that before.

crankydillo

unread,
Dec 22, 2012, 6:50:56 PM12/22/12
to specs...@googlegroups.com
Well, I must be crazy,

-ex add two numbers

worked.  However, I that also matched "should not add two numbers when ..."  Still, it's way better than what I had.

Many thanks!

etorreborre

unread,
Dec 22, 2012, 7:18:12 PM12/22/12
to specs...@googlegroups.com
If you want to precisely match "add two numbers" you can use "^" and "$" to match the beginning and end of line: ^add two numbers$.

Also if you want to migrate to specs2 I can help you with solving the few differences there exist. There is also a migration guide here: http://etorreborre.blogspot.com.au/2011/05/specs2-migration-guide.html.

crankydillo

unread,
Dec 23, 2012, 7:26:17 AM12/23/12
to specs...@googlegroups.com
I really believed the spaces caused a problem and always assumed I needed to escape them somehow.  I totally forgot about '^' and '$'.

Given how helpful you've been, it's highly likely I'll give a specs2 migration another go.

Many thanks!
Reply all
Reply to author
Forward
0 new messages