Marie Cruz
Marie is a software tester and also a tech blogger at testingwithmarie.com where she talks about testing and test automation in general. Currently, she works as a Developer Advocate for k6.io
👍🏼 Tests the real behaviour
👍🏼 Catch performance issues
👍🏼 More confidence that critical paths are verified
👍🏼 Straightforward to test
👍🏼 Speeds up development
👍🏼 Speeds up testing
👍🏼 Quicker to run
👍🏼 Simulate delays
👍🏼 Avoids flaky tests as results are deterministic
👍🏼 Simulate different scenarios easily and test different status codes
👎🏼 Slower to run
👎🏼 Requires a dedicated environment
👎🏼 Can cause flaky tests if the API is still in development mode
👎🏼 Makes application under test dependent on other services
👎🏼 More effort to maintain
👎🏼 Bugs can be missed if mock API is not updated
Consider a Hybrid Approach
/// <reference types="cypress" />
describe('Todo API', () => {
it('returns a JSON data', () => {
cy.request('/todos')
.its('headers')
.its('content-type')
.should('include', 'application/json');
});
});
By Marie Cruz
In this lunch and learn session, we'll look at how we can mock XHR requests with Cypress.
Marie is a software tester and also a tech blogger at testingwithmarie.com where she talks about testing and test automation in general. Currently, she works as a Developer Advocate for k6.io