April 2018
Intermediate to advanced
432 pages
10h 38m
English
Defining scenarios with Spring Cloud Contract is not difficult. The only thing you have to do is to provide the proper naming convention while creating a contract. This convention assumes that every contract's name that is a part of the scenario is prefixed by an order number and an underscore. All the contracts included in a single scenario have to be located in the same directory. Spring Cloud Contract scenarios are based on WireMock's scenarios. Here's a directory structure with contracts defined for the needs of scenario that creates and accepts an order:
src\main\resources\contracts orderService\ 1_createOrder.groovy 2_acceptOrder.groovy
The following is the test's source code generated for this scenario:
@FixMethodOrder(MethodSorters.NAME_ASCENDING) ...