Integration Tests


If you are calling an c.t.util.Await function on a c.t.util.Future return type in a test, it is generally considered good practice to ensure that your c.t.util.Await call includes a timeout duration, e.g., c.t.util.Await#ready.

Whereas Feature Tests start a server or app under test (thereby loading its entire object graph), integration tests generally only test across a few interfaces in the system. In Finatra, we provide the which allows you to pass it a set of modules and flags to construct a minimal object graph.

To write an integration test, extend the c.t.inject.IntegrationTest trait. Then override the injector val with your constructed instance of You’ll then be able to access instances of necessary classes to execute tests.

import com.twitter.inject.IntegrationTest

class ExampleIntegrationTest extends IntegrationTest {
  override val injector =
      flags =
        Map("foo.flag" -> "meaningfulValue"),
      modules =

  test("MyTest#perform feature") {
    val exampleThingy = injector.instance[ExampleThingy]


The injector is specified as a def the in c.t.inject.IntegrationTestMixin trait. If you only want to start one instance of your injector per test file make sure to override this def with a val.

Http Tests

If you are writing a test that has an HTTP server under test, you can also extend the c.t.finatra.http.HttpTest trait. This trait provides some common utilities for HTTP testing, specifically utilities for constructing a resolverMap flag value for setting on your server under test.

Thrift Tests

As shown above, thrift servers can be tested through a c.t.finatra.thrift.ThriftClient. The Finatra test framework provides an easy way get access to a real Finagle client for making calls to your running server in a test.

See the Feature Tests - Thrift Server section for more information on creating a Finagle Thrift client.

Additionally, your test can also extend the c.t.finatra.thrift.ThriftTest trait which provides a utility specifically for constructing a resolverMap flag value for setting on your server under test.