Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to do unit/integration/end-to-end tests with 3rd party APIs (backend)? #9

Open
codihuston opened this issue Jan 12, 2020 · 7 comments

Comments

@codihuston
Copy link
Owner

Refs: https://medium.com/@axelhodler/integration-tests-for-third-party-apis-dab67c52e352

@codihuston
Copy link
Owner Author

Mocking the google API response would probably be easier to implement. Really, need to only test the functionality of Gairos against a stub of the Google API... Which would probably make this more of a unit test.

Anything that needs to interact with out the Gairos API can be integration tested on its own...

@codihuston
Copy link
Owner Author

Unit tests were added as of : 0ae2350 and b6623c9

@codihuston codihuston changed the title How to do integration tests with 3rd party APIs? How to do unit/integration/end-to-end tests with 3rd party APIs? Jan 13, 2020
@codihuston
Copy link
Owner Author

@codihuston
Copy link
Owner Author

codihuston commented Jan 14, 2020

E2e would test all of the app as if you were an end user. You would likey mock out any external services (backend 3rd party api responses, maybe database connections etc... it really all depends)

@codihuston
Copy link
Owner Author

If you would like to do e2e testing across both the front and back end, it may be ideal to use the CDC approach.

If not, you would generally peogramatically query the app individually, and ensure that it responds a certain way. You may implement services, like databases, in these tests.

I.e.) use an http client to query an endpoint, and ensure that the response body is what it is expected to be. You may use any external services (database, etc.) If you can. Ideally, you should (but do not include the front end. If you decide to go that far, it looks like CDC is the way to go).

@codihuston codihuston changed the title How to do unit/integration/end-to-end tests with 3rd party APIs? How to do unit/integration/end-to-end tests with 3rd party APIs (backend)? Jan 14, 2020
@codihuston
Copy link
Owner Author

https://docs.pact.io/faq

What is Pact good for?

Pact is most valuable for designing and testing integrations where you (or your team/organisation/partner organisation) control the development of both the consumer and the provider, and the requirements of the consumer are going to be used to drive the features of the provider. It is fantastic tool for developing and testing intra-organisation microservices.

What is Pact not good for?

Testing APIs where the number of consumers is so great that direct relationships cannot be maintained between the consumer teams and the provider team.
Performance and load testing.
Functional testing of the provider - that is what the provider’s own tests should do. Pact is about checking the contents and format of requests and responses.
Situations where you cannot load data into the provider without using the API that you’re actually testing (eg. public APIs). Why?
Testing “pass through” APIs, where the provider merely passes on the request contents to a downstream service without validating them. Why?

@codihuston
Copy link
Owner Author

Implemented unit + integration as of: 46ac50a

Placing on hold for e2e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant