Test Mixins

Twitter’s recommended ScalaTest test style is FunSuite.

You can use this ScalaTest test style by extending either:

There are also deprecated versions which mix-in the WordSpec testing style:

  • c.t.inject.WordSpecTest
  • c.t.inject.WordSpecIntegrationTest
  • c.t.inject.server.WordSpecFeatureTest

However, you are free to choose a ScalaTest testing style that suits your team by using the test mixin companion classes directly and mix in your preferred ScalaTest style:

An example of using the c.t.inject.server.FeatureTestMixin with the FunSpec ScalaTest test style:

import com.google.inject.Stage
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTestMixin
import org.scalatest.FunSpec

class SampleApiStartupTest
  extends FunSpec
  with FeatureTestMixin {

  override val server = new EmbeddedHttpServer(
    twitterServer = new SampleApiServer,
    stage = Stage.PRODUCTION,
    flags = Map(
      "foo.flag" -> "bar"
    )
  )

  describe("Sample Server") {
    it("should startup") {
      server.assertHealthy()
    }
  }
}