Oğuzhan Soykan
08/18/2023, 10:42 AMtestcontainers
in your project you can easily switch to Stove for humanized way of writing tests alongside having the physical deps of your API.
Here is how an e2e test looks like with new DSL:
TestSystem.validate {
wiremock {
mockGet("/example-url", responseBody = None, statusCode = 200)
}
http {
get<String>("/hello/index") { actual ->
actual shouldContain "Hi from Stove framework"
}
}
couchbase {
shouldQuery<Any>("SELECT * FROM system:keyspaces") { actual ->
actual shouldBe "keyspaces from your db"
}
}
kafka {
shouldBePublishedOnCondition<ExampleMessage> { actual ->
actual.aggregateId == 123
}
shouldBeConsumedOnCondition<ExampleMessage> { actual ->
actual.aggregateId == 123
}
}
couchbase {
save(collection = "Backlogs", id = "id-of-backlog", instance = Backlog("id-of-backlog"))
}
http {
postAndExpectBodilessResponse("/backlog/reserve") { actual ->
actual.status shouldBe 200
}
}
kafka {
shouldBeConsumedOnCondition<ProductCreated> { actual ->
actual.aggregateId == expectedId
}
}
}
David Nault
08/22/2023, 9:06 PMOğuzhan Soykan
09/07/2023, 8:50 AM