1
sbtを実行しているspec2コンシューマのPact JVMに問題があります。 - 何が間違っている可能性がありますか? - 私はpactファイルを生成しません。pact-jvm-consumer-specs2 - 欠落:[エラー]メソッド:GET
与えられた:依存関係
"au.com.dius" %% "協定-JVM-消費者specs2" % "3.2.11"
と
のsbtプロジェクト」 org.specs2" %% "specs2-JUnitの" % "3.3.1"
私が持っているスペッククラス:
import java.util.concurrent.TimeUnit.MILLISECONDS
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.HttpRequest
import akka.stream.ActorMaterializer
import au.com.dius.pact.consumer.PactSpec
import org.junit.runner.RunWith
import org.specs2.mutable.Specification
import org.specs2.runner.JUnitRunner
import scala.concurrent.duration._
import scala.concurrent.Await
import scala.concurrent.duration.Duration
@RunWith(classOf[JUnitRunner])
class PactClientSpec extends Specification with PactSpec {
sequential
override val provider: String = "SpecsProvider"
override val consumer: String = "SpecsConsumer"
implicit val actorSystem = ActorSystem()
implicit val materializer = ActorMaterializer()
implicit val dispatcher = actorSystem.dispatcher
val timeout = Duration(5000, MILLISECONDS)
override def is = uponReceiving("a request for foo")
.matching(path = "https://stackoverflow.com/users/1234")
.willRespondWith(body = "{}")
.withConsumerTest { providerConfig =>
val responseFuture= Http().singleRequest(HttpRequest(uri = s"http://${providerConfig.url}/users/1234"))
val response = Await.result(responseFuture, 10 seconds)
"Hello world" must endWith("world")
}
}
私は私が手SBTテストを実行する場合:
x Consumer 'SpecsConsumer' has a pact with Provider 'SpecsProvider': a request for foo 2
[error]
[error] missing:
[error] method: GET
[error] path: /users/1234
[error] query: null
[error] headers: [:]
[error] matchers: [:]
[error] body: au.com.dius.pact.model.OptionalBody(EMPTY,) (PactSpec.scala:29)
[info] PactClientSpec
[info]
[info] Total for specification PactClientSpec
[info] Finished in 707 ms
[info] 1 example, 1 failure, 0 error
[info]
[info] ScalaCheck
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] ScalaTest
[info] Run completed in 2 seconds, 562 milliseconds.
[info] Total number of tests run: 0
[info] Suites: completed 0, aborted 0
[info] Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
[info] No tests were executed.
[error] Failed: Total 1, Failed 1, Errors 0, Passed 0
[error] Failed tests:
[error] PactClientSpec
[error] (token-manager/test:testOnly) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 8 s, completed Sep 29, 2016 2:26:52 PM