Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Opinion: pattern for API testing #25

Open
akauppi opened this issue Jan 17, 2020 · 0 comments
Open

Opinion: pattern for API testing #25

akauppi opened this issue Jan 17, 2020 · 0 comments
Assignees

Comments

@akauppi
Copy link

akauppi commented Jan 17, 2020

I looked at this repo as an authorative sample of using Cypress for REST API tests.

As such, I think it should present good ways of working. However, if I got it right, it currently uses one antipattern, here:

https://github.com/cypress-io/cypress-example-api-testing/blob/master/cypress/integration/example_spec.js#L37-L40

The mindset of Cypress testing should be to prepare and cleanup the backend directly, not via the API-under-test. This one seems to use the API itself.

Unfortunately, I don't know how to fix the sample. What I'm concerned about is that people will learn from this, and later - maybe - realize the pattern was not ideal. I ended up using direct node.js database client to do the setup/cleanup, whereas using my REST API only for things that get tested.

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

No branches or pull requests

2 participants