lundi 28 août 2017

What to Assert in E2E Test Cases - Best Practices

I recently transferred to an existing (but new) project, still in beta, that already has a fair amount of unit, integration, and system / e2e tests. Presently, a large portion of integration and system tests are asserting equality between an expected JSON payload and the actual JSON payload.

Considering the fast moving nature of this project (and that it's in beta), changes are often causing many tests to flip red, as they're changing the JSON payload. It seems redundant to frequently change expected JSON payload to match the new output, but I'll do it without complaining if I know that's the ideal way to test.

My question (TLDR): In the case of a JSON API, if I am only testing "Happy Path" e2e / system test scenarios; what would my ideal assertion statement? Am I looking to test the entire payload against an expected payload or would it make more sense to compare status codes, and maybe some high level JSON keys?

Aucun commentaire:

Enregistrer un commentaire