You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the unit tests rely on the "Trippin" example service. Which means that the unit tests actually rely on this API to work. I've seen multiple examples where the library produces the correct request, but the API fails with HTTP status code 500, causing the tests to fail anyway.
IMO, it would be better to simply test the request object before it goes out to any server. Since the project currently uses Jasmine for testing, one possibility is to use jasmine-ajax to intercept the requests and run tests on them.
This way, the URL, method, data, etc can be tested without actually relying on a real API to respond. This also allows tests to be run in a offline-only scenario when developing.
Thoughts? As long as the tests enforce the OData protocol spec, it should be a better approach and allow for corner case testing without the Trippin service implementing that endpoint.
The text was updated successfully, but these errors were encountered:
I like the idea. But it is not an easy task. The test-mocks must follow the specs and therefore somebody has to invest time to set-up the mocks correctly.
Jasmin-Ajax looks like a good library to do that and this will allow us to test all internal functions until the initialized request. Another idea is to fake any request which is going to base.get(), base.post() (etc.), but this will only allow us to test the public available functions.
Currently, the unit tests rely on the "Trippin" example service. Which means that the unit tests actually rely on this API to work. I've seen multiple examples where the library produces the correct request, but the API fails with HTTP status code 500, causing the tests to fail anyway.
IMO, it would be better to simply test the request object before it goes out to any server. Since the project currently uses Jasmine for testing, one possibility is to use jasmine-ajax to intercept the requests and run tests on them.
This way, the URL, method, data, etc can be tested without actually relying on a real API to respond. This also allows tests to be run in a offline-only scenario when developing.
Thoughts? As long as the tests enforce the OData protocol spec, it should be a better approach and allow for corner case testing without the Trippin service implementing that endpoint.
The text was updated successfully, but these errors were encountered: