Running specs from in a Scala 'script'

7 views
Skip to first unread message

crankydillo

unread,
Mar 2, 2011, 1:45:12 PM3/2/11
to specs-users
Hi,

I know it sounds crazy, but I'm trying to run specs as a script, e.g.
scala -cp specs.jar MyScript. The specifications are defined within
MyScript.

object Spec1 extends Specification {
"a" should {
"b" in {} // this works fine if by itself
"c" in {} // now it goes crazy and runs my Spec1 a bunch of
times

}
val specs = List(Spec1)
val runner = new ConsoleRunner();
runner.report(specs)

It also happens if I add "d" should {}.

Any ideas on how to get this to work nicely is greatly appreciated.

etorreborre

unread,
Mar 2, 2011, 4:50:30 PM3/2/11
to specs-users
Hi, I'm not sure which version you're using, can you please make sure
you're trying the latest version?

Otherwise, specifications can be executed right away to the Console
because they have a main method. So you should be able to write:

object Spec1 extends Specification {
"a" should {
"b" in {}
"c" in {}
}

Spec1.main(Array[String]())

Eric.

crankydillo

unread,
Mar 2, 2011, 5:49:54 PM3/2/11
to specs-users
I've tried 1.6.5 and 1.6.7. I'll look for a newer version and try
your case tomorrow. Many thanks!

Alexey Romanov

unread,
Mar 2, 2011, 5:52:18 PM3/2/11
to specs...@googlegroups.com
Cool, I didn't know that.

Yours, Alexey Romanov

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

crankydillo

unread,
Mar 3, 2011, 8:42:46 AM3/3/11
to specs-users
I tried this and got the same behavior. I used Scala 2.8.1 and specs
1.6.7. Did you try your snippet using:

> scala -cp lib\* SpecScript

?

I've already got compile -> run going, so I'm not overly concerned. I
was just trying to show off how Scala could be used as a scripting
tool.

On Mar 2, 3:50 pm, etorreborre <etorrebo...@gmail.com> wrote:

etorreborre

unread,
Mar 3, 2011, 6:09:14 PM3/3/11
to specs-users
Yes, I confirm what you saw. I guess it has to do with the way new
instances are instantiated in the interpreter because when I add
"shareVariables" at the beginning of the specification it works fine.

E.
Reply all
Reply to author
Forward
0 new messages