Re: [sbt] how to setup integration test to run tests from src/test/scala with a specific class name (0.12.1)

146 views
Skip to first unread message

Mark Harrah

unread,
Jan 11, 2013, 9:02:09 AM1/11/13
to simple-b...@googlegroups.com
Hi Albert,

On Thu, 10 Jan 2013 06:36:41 -0800 (PST)
Albert Sikkema <a.sik...@gmail.com> wrote:

> Hi,
>
> I'd like to use the integration test to run my integration tests. However I
> don't have my integration tests in src/it/... but they are in src/test/...
> I'd like to use the name of the test to differentiate between unit and
> integration tests (Test / Spec). Here's my setup:
>
> lazy val testSettings = Seq(
> parallelExecution in Test := false,
> testOptions in Test := Seq(Tests.Filter(s => s.endsWith("Test")))
> )
>
> lazy val integrationTestSettings = Seq(
> scalaSource in IntegrationTest <<= baseDirectory / "src/test/scala",
> testOptions in IntegrationTest := Seq(Tests.Filter(s =>
> s.endsWith("Spec")))
> )
>
> lazy val myProject = Project(
> "myProject", file("."),
> settings = buildSettings
> ++ Seq(resolvers := repositories, libraryDependencies ++=
> dependencies)
> ++ testSettings
> ++ integrationTestSettings
> ).configs(IntegrationTest)
> .settings( Defaults.itSettings : _*)
> .settings(libraryDependencies += specs)

Order matters, since settings defined later will override earlier ones. In this case, make sure to put Defaults.itSettings, which defines the default value for scalaSource in IntegrationTest, before integrationTestSettings.

You can verify that the values of settings are as you expect with 'show it:scala-source' or 'inspect it:scala-source'. In 0.13, you'll be able to do 'inspect it:scalaSource' and it will show where the value was initialized (such as project/Build.scala:11).

-Mark

>
> When I run it:test it still searches the src/it path. I'm struggling to
> find where the paths are actually set, but I think it should be something
> like this. Any pointers?
> I'm using sbt 0.12.1
>
> Many thanks,
> Albert
>
> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/simple-build-tool/-/eym-ezhytt8J.
> 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.
>

Reply all
Reply to author
Forward
0 new messages