Karate
🥋 en tests d’API REST @NicolasComet
https://github.com/ncomet
@binout
https://github.com/binout
@Test
public void should_process_order_and_then_cancel() throws Exception {
// Create new Order
final String orderId = IntegrationTestCase.newProductOrderId();
// Process Order
final Response response = IntegrationTestCase.newClient().path("/product-orders/" + orderId)
.request()
.put(Entity.json("{\"reference\" : \"ABTYD\"}"));
assertThat(response.getStatusInfo()).isEqualTo(Status.OK);
// Cancel Order
final Response response = IntegrationTestCase.newClient().path("/product-orders/" + orderId)
.request()
.delete();
assertThat(response.getStatusInfo()).isEqualTo(Status.NO_CONTENT);
}
@Test
public void lotto_resource_returns_200_with_expected_id_and_winners() {
when().
get("/lotto/{id}", 5).
then().
statusCode(200).
body("lotto.lottoId", equalTo(5),
"lotto.winners.winnerId", containsOnly(23, 54));
}
Web-Services Testing Made Simple.Peter Thomas (Intuit)
https://github.com/intuit/karate (+1000 )
@KarateDSL
0.1.2
)0.8.0
https://pokeapi.co/api/v2/pokemon/
java -jar karate.jar -t pokemon.feature
DSL Gherkin
pour écrire des tests d’APIs HTTP MAIS ce n’est pas du BDD !
👍
⚠️
Utilisation des .feature
comme source de scénario Gatling
@KarateDSL as a UI automation framework ?
— Peter Thomas (@ptrthomas) 24 septembre 2018
I think this may *actually* work ! pic.twitter.com/6j47L3kLQo
working through the "Cucumber Exit" for @KarateDSL code-named CUKEXIT :Phttps://t.co/fao8Fn5qRM
— Peter Thomas (@ptrthomas) 29 juillet 2018
Le code et les slides : /ncomet/karate-conf2018
/