Skip to content

Instantly share code, notes, and snippets.

@lancegatlin
Last active March 28, 2019 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lancegatlin/d7e4a9b50ff3d1c75b4c014bcfbb90fe to your computer and use it in GitHub Desktop.
Save lancegatlin/d7e4a9b50ff3d1c75b4c014bcfbb90fe to your computer and use it in GitHub Desktop.
import sbt.Keys._
import sbt._
object IntegrationTest {
// Select integration tests that use local running resources
lazy val IntgLocalTest = config("intg_local") extend Test
// Select integration test that connect to dev env
lazy val IntgDevTest = config("intg_dev") extend Test
// Select all integration tests
lazy val IntgTest = config("intg") extend Test
lazy val configs = Seq(IntgLocalTest, IntgDevTest, IntgTest)
val settings : Seq[Def.Setting[_]] =
inConfig(IntgDevTest)(Defaults.testTasks) ++
inConfig(IntgLocalTest)(Defaults.testTasks) ++
inConfig(IntgTest)(Defaults.testTasks) ++
Seq(
// exclude integration tests in Test
testOptions in Test := Seq(
Tests.Argument(TestFrameworks.ScalaTest, "-l","IntgTest"),
Tests.Argument(TestFrameworks.ScalaTest, "-l","IntgLocalTest"),
Tests.Argument(TestFrameworks.ScalaTest, "-l","IntgDevTest")
),
// only run tagged tests in IntgTest, IntgLocalTest and IntgDevTest
testOptions in IntgLocalTest := Seq(
Tests.Argument(TestFrameworks.ScalaTest, "-n","IntgLocalTest")
),
testOptions in IntgDevTest := Seq(
Tests.Argument(TestFrameworks.ScalaTest, "-n","IntgDevTest")
),
testOptions in IntgTest := Seq(
Tests.Argument(TestFrameworks.ScalaTest, "-n","IntgTest")
),
// don't run integration tests in parallel since they use external resources
parallelExecution in IntgTest := false,
parallelExecution in IntgDevTest := false,
parallelExecution in IntgLocalTest := false
)
}
package
import org.scalatest.Tag
object IntgTest extends Tag("IntgTest")
object IntgLocalTest extends Tag("IntgLocalTest")
object IntgDevTest extends Tag("IntgDevTest")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment