Testing the Product service
Let's apply the testing principles we learned to the Product service that we have been building so far. We start from a user point of view and hence with acceptance testing.
BDD through Cucumber
The first step is to recall the specification of our product service. In Chapter 4, Extending Your Cloud-Native Application, we built a few features on our product service that allowed us to fetch, add, modify, and delete products, and get a list of product IDs given a product category.
Let's represent this as features in Cucumber.
Why Cucumber?
Cucumber allows the expression of behavior in a plain-English-like language called Gherkin. This enables a ubiquitous language from the domain-driven design parlance, so that the communication between the business, development, and testing is seamless and well-understood.
How does Cucumber work?
Let's understand how Cucumber works:
- The first step in Cucumber is to express the user story as features with scenarios, and
Given
-When
-Then
conditions...