vendredi 9 mars 2018

Test ionic app with real http requests - Integration Test

I want to test my app and I am not sure which kind of test to use for which purpose.

I have an app that loads a page with the given data, then starts a http request (with a provider) to load and update the data in the view. If you click on some piece of data, the next page gets the data already there and then loads the rest and updates and so on. I want to test the update functions and the http requests.

I want to test my app from end to end, so I tried using e2e testing (with pretractor). But I found no way to check the data in the background, e.g. the data comming back from the server or the data held in my data model. Besides, my information is that the e2e test should be used for UI testing rather than function testing.

So I tried unit-testing (with Jasmine and Karma). I can access the right functions and variables, but I found no way to use the real http requests (not mockups) for my tests. Furthermore I need the result from the last page to send the right http request for the current page and I understand that this is not what unit testing is supposed to do.

I think I need some kind of integration test, but I have no idea how to implement this with ionic 3. So: Which test should I use and how to use it to to what I need?

Aucun commentaire:

Enregistrer un commentaire