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

Tests with fake API on CI #147

Closed
Korbeil opened this issue Oct 17, 2019 · 5 comments · Fixed by #412
Closed

Tests with fake API on CI #147

Korbeil opened this issue Oct 17, 2019 · 5 comments · Fixed by #412

Comments

@Korbeil
Copy link
Member

Korbeil commented Oct 17, 2019

Let's step up our tests !

Today we are running Client generation and check that generated Clients are matching what we think was ok (based on excepted folder).
I would like to test generated Client aswell, and running them against some "fake" API.

For this "fake" API, I think https://github.com/typicode/json-server would fit perfectly ! We just need a way to make this clean and working for most of our test fixtures.

@chadyred
Copy link

chadyred commented Apr 3, 2020

Does this tool act with interceptor more Mocking concept like nock : you define your own response ?

It will intercept an HTTPS GET request to /repos/atom/atom/license, reply with a status 200, and the body will contain a (partial) response in JSON we given.

https://github.com/nock/nock#read-this---about-interceptors

I think about the network layer, if your fake API go down. In other word, fake API live on a Network layer, with real response but depends this Network layer.

I read more here about the realistic side between local vs networking fake API :https://stoplight.io/mock-api-guide/basics/

@Korbeil
Copy link
Member Author

Korbeil commented Apr 7, 2020

Actually https://github.com/typicode/json-server does run a "real" API, my idea here was to make a "big" API for each component that regroup everything we should test. It is not mandatory to test everything, but some stuff like Authentication should be tested for example ~

@Korbeil
Copy link
Member Author

Korbeil commented Apr 7, 2020

Another solution would be https://github.com/stoplightio/prism (thanks @damienalexandre for sharing !), it looks really awesome !

@Jaesin
Copy link

Jaesin commented May 19, 2020

I think this is a great idea. I usually add a middleware that returns mock responses that are generated using the serializer. An example: https://github.com/apigee/apigee-mock-client-php

@Korbeil Korbeil linked a pull request Sep 11, 2020 that will close this issue
3 tasks
@Korbeil
Copy link
Member Author

Korbeil commented Oct 13, 2020

This issue has been fixed since #412 has been merged. (I actually don't understand why github didn't closed this issue since it was linked 🤔)

@Korbeil Korbeil closed this as completed Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants