Skip to content

mayankdigii/backend-made-easy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReadMe

Commands Used

  • npm init

  • npm i express

  • npm i cypress --save-dev

  • npm cypress open

  • Run the all the test cases

    • npx cypress run --spec "cypress/e2e/api-tests/*.cy.js"
  • Run single test case at once

    • npx cypress run --spec "cypress/e2e/api-tests/getUsers.cy.js"

Notes

  • We use describe and it from Mocha and expect from the chai, we dont need to explicit download

  • GET CALL

  • POST CALL

  • USING Fixtures in POST CALL

  • PUT Call

  • Delete Call

  • Nesting of the Responses

  • Pros and Cons of Test cases

  • Stubbing , Intercept

  • Using Fixtures in Intercept

Pros and Cons

Benefits

More likely to work in production Test coverage around server endpoints Great for traditional server-side HTML rendering

Downsides

Requires seeding data Much slower Harder to test edge cases

=====> Solution : Stubbing ( Basically FakeResponse)

Maniupulate acc to the needs in the local , no work is done on the server

Benefits

Control of response bodies, status, and headers Can force responses to take longer to simulate network delay No code changes to your server or client code Fast, < 20ms response times

Downsides

No guarantee your stubbed responses match the actual data the server sends No test coverage on some server endpoints Not as useful if you're using traditional server side HTML rendering

How it is done

cy.intercept() is used to control the behavior of HTTP requests. You can statically define the body, HTTP status code, headers, and other response characteristics.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published