Exectuing Specs in an Order

15 views
Skip to first unread message

JayD

unread,
Nov 11, 2011, 3:33:00 AM11/11/11
to specs-users
Hi,

I am new to Specs, and I was wondering if there is a way to execute
Specs in a Specific Order.

I have two classes which extends Specification like,

UserRepositorySpec extends Specifications {
"System" should{
doFirst(something) //drop db tables
"test 1" in { }
"test2" in { }
}
}

RegisterSpec extends Specifications {
"System" should{
doFirst(something) //drop db tables
"test 1" in { }
"test 2" in { }
}
}

Now if run these tests one by one using test-only, they seem to Pass
without any errors, but if I run them together, using just 'test' in
SBT I seem to get errors like table not existing.

So can someone help me with a way to run Specs one after the other?

Thanks in advance

etorreborre

unread,
Nov 11, 2011, 4:48:42 AM11/11/11
to specs...@googlegroups.com
Hi,

By default sbt will execute specifications in parallel. In your case, this is going to create an issue so you should deactivate this option:

https://github.com/harrah/xsbt/wiki/Testing => parallelExecution in Test := false

Also, if you're new to specs, I would encourage you to have a look at specs2 instead, which is the library that going to evolve going forward.

Thanks,

Eric.

etorreborre

unread,
Nov 11, 2011, 4:54:33 AM11/11/11
to specs...@googlegroups.com
BTW, just to be more complete on my previous answer, you could also try a different approach:

  • include all your specifications using the database in a "parent" one
  • using a naming convention so that sbt only executes the parent one and not the children (by using something like: testOptions in Test := Seq(Tests.Filter(s => !s.endsWith("Database"))))
Eric.

JayD

unread,
Nov 14, 2011, 1:24:57 AM11/14/11
to specs-users
Thanks a lot Eric.. deactivating the parallelExecution option worked
for me. Thanks again.

On Nov 11, 2:48 pm, etorreborre <etorrebo...@gmail.com> wrote:
> Hi,
>
> By default sbt will execute specifications in parallel. In your case, this
> is going to create an issue so you should deactivate this option:
>
> https://github.com/harrah/xsbt/wiki/Testing=> parallelExecution in Test :=
> false
>
> Also, if you're new to specs, I would encourage you to have a look at
> specs2 instead, which is the library that going to evolve going forward.*
> *
>
> Thanks,
>
> Eric.
Reply all
Reply to author
Forward
0 new messages