I would like to use Spring Cloud Contract (https://spring.io/projects/spring-cloud-contract) in order to test frontend to backend interactions: especially to catch such errors as 400 http errors.
I was able to run my stubs with the spring cloud contract stub runner. However I noticed that when the actual backend would return a 400, the running stubs return a 404 not found error.
Here is my contract:
description: |
Signup use case
```
given:
a user signs up
when:
the sign up request is valid
then:
the user is signed up
```
request:
method: POST
url: /api/signup
body:
userAccountType: PARENTS
email: [email protected]
firstName: John
plainPassword: secret
address:
placeId: 'an_id'
description: '10 Downing Street'
headers:
Content-Type: application/json
response:
status: 200
If my frontend (i.e. Angular) just issues a Http POST with, say the email field missing, then I expect the running stubs to return a 400.
I would be grateful if someone could share best practices or tips in order to better leverage Spring Cloud Contract for the purpose of frontend/backend tests.
400? Do I have to write contracts (with status400) for each of the combinations of invalid requests? - balteo