Test Mixins

Important

Please see the section on including test-jar dependencies in your project: Test Dependencies.

Twitter’s recommended ScalaTest test style is FunSuite.

You can use this ScalaTest test style by extending either:

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()
    }
  }
}

More Information