0
Play 2 프레임 워크를 사용하는 간단한 웹 앱이 있습니다.하나의 Play 2 specs2 단위 테스트에서 여러 요청을 수행하는 방법
- / 는/내가 그것에 대한 기능 테스트를 구현하려는
을 읽기, 쓰기 : 그것은 두 REST API를 가지고있다. 테스트에서 /write
을 여러 번 호출 한 다음 /read
의 결과를 확인합니다.
는 그러나 route
함수는 Future
를 반환하고, 나는 specs2 내 Future
기다릴 수 있도록하는 방법을 찾을 수 없습니다.
object MySpec extends Specification {
"/write * 2, then /read" in new WithApplication {
val write1 = route(app, FakeRequest(GET, '/write')).get
val write2 = route(app, FakeRequest(GET, '/write')).get
val read = route(app, FakeRequest(GET, '/read')).get
// how to chain the requests so the execute one after another, and the specs2 can wait for it?
status(read) must_==OK
}
}