vendredi 14 février 2020

How to correctly implement Vue.js tests?

I'm confused about testing my Vue.js application. First of all, I'm not quite comfortable with the different types of tests and what they are supposed to do.

This is what I'm currently doing for a Vue.js SPA that uses different APIs:

On the unit testing side: I run them using Jest & Vue test-utils. I use createLocalVue to simulate the Vuex store and I mock the API calls.

On the e2e testing side : I run them using Cypress. The first reflex was to use fixtures to mock the API call responses too, because I want to test the frontend working properly before merging without being dependent on API availability.

But I realize that my unit tests and e2e tests are very similar in the end.

Finally I have a lot of questions...

Ideally, should the e2e tests do the real API calls?

Can my unit tests really be considered as unit tests when I mock certain elements such as the Vuex store ?

What is the difference between e2e testing and integration testing?

Thanks for your help.

Aucun commentaire:

Enregistrer un commentaire