mercredi 13 février 2019

Acceptance tests for REST API

Our team is doing ATDD(Acceptance Test Driven Development) for our projects.

And I have a question.

I write API tests like below.

1) creating fixtures

2) sending headers, query, path, body to endpoint.

3) assert response of status code, body, etc

And here is the question!

Should I write all test cases for exceptional case (like invalid body field and value combinations) in acceptance tests?

For example, POST /users receives body like { name: "steve", age: 27, account: "test", password: "test1234" }

Do you write test cases for all body input combinations? (If name is empty, return 400 / If name is too short, return 400 / If age is not number, return 400 / If password does not contain number, return 400 and so on)

There are too many cases:(

If you don't, can you share with me how you deal with this?

Aucun commentaire:

Enregistrer un commentaire