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

Opinion: pattern for API testing #25

@akauppi

Description

@akauppi

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions