Skip to content

Instantly share code, notes, and snippets.

@agaro1121
Last active July 6, 2016 17:40
Show Gist options
  • Save agaro1121/db2562df2c84c795f472651c91da1e5a to your computer and use it in GitHub Desktop.
Save agaro1121/db2562df2c84c795f472651c91da1e5a to your computer and use it in GitHub Desktop.
Setting up proper sbt integration tests in Play SBT

Build.sbt

Defaults.itSettings
sourceDirectory in IntegrationTest := baseDirectory.value / "test-integration"
libraryDependencies +=
  "com.typesafe.play" %% "play-test" % play.core.PlayVersion.current % "it" //makes this available to integration tests
parallelExecution in IntegrationTest := false //Singleton Mongo Client not thread-safe for parallel tests. NullPointer being thrown because 1 test closed the connection while the other test needed it
lazy val root = (project in file("."))
.configs(IntegrationTest)

Add "it" to any dependencies that specify "test" i.e val scalaTest = "org.scalatest" %% "scalatest" % scalaTestVersion % "it,test"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment