Users mix-in their preferred TestDriver implementation, to execute their tests.
class PersonSpec extends FlatSpec {
this: TestDriver =>val EmptyList = Seq[Person]()
"/person (collection)" should "be empty" in {
GET / "person" asserting (StatusCode === Status.OK, BodyAsPersonList === EmptyList)
}
}
class PersonUnitSpec extends PersonSpec with SprayUnitTestDriver with MyService
class PersonSystemSpec extends PersonSpec with JerseySystemTestDriver {
overrideval baseUrl = "http://localhost:9000"
}
Subclasses implement the interface supplying a httpClient to execute the
Requests and a defBuilder which provides the base configuration for all
tests. All tests should support relative paths, this enables the same test
code to be executed as a unit test and a system test. To support this
the defBuilder for system test drivers should supply the baseUrl some how.
The test driver defines the Api.HttpClient and initial Api.RequestBuilder used to execute Rest Tests.
Users mix-in their preferred TestDriver implementation, to execute their tests.
Subclasses implement the interface supplying a httpClient to execute the Requests and a defBuilder which provides the base configuration for all tests. All tests should support relative paths, this enables the same test code to be executed as a unit test and a system test. To support this the defBuilder for system test drivers should supply the baseUrl some how.