Answer the question
In order to leave comments, you need to log in
How to organize testing of backend requests in Protractor?
There is an application on Angular. As you know, $httpBackend is used to receive/send data to the server. And I want to use $httpBackend - mock
when E2E testing these requests with Protractor .
Those. we run the tests, Protractor works normally, requests go through the working $httpBackend, and when a certain test is performed (checking the submission of data through the form), $httpBackend is slipped - mock, PUT and GET go through it (test data from Protractor is sent to the database on the server are not dropped).
How to organize it? Here, too, they are trying to find a solution to this problem, but a good solution has not yet been found.
Answer the question
In order to leave comments, you need to log in
the essence of E2E tests is to test everything, no mocks and stubs (well, stubs are possible for some external services like Facebook, and then they have a sandbox). To test the entire passage, from buttons on the UI to queries to the database on the server.
As part of integration tests, it also makes no sense to test the UI. UI must be declarative, which means that there are no invariants that need to be covered by tests. That is, in fact, we need to cover only the service layer and possibly controllers with tests.
If you really want to test the UI in integration tests - well, ok, set up a separate mock server that you will manage from the test suite. Thankfully there are many.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question