Cypress API Testing : REST API Testing with Cypress( Full CRUD Example)

Sdílet
Vložit
  • čas přidán 11. 09. 2024
  • In this video cypress tutorial for beginners, We are going to learn perform REST API Testing with cypress.
    Cypress API Testing can be done with the following method cy.request given with the cypress modules.
    As we know that, Cypress is a JavaScript test automation solution for web applications.
    It enables teams to create web test automation scripts.
    This solution aims to enable frontend developers and test automation engineers to write web tests in the de-facto web language that is JavaScript.
    Cypress also supports the Mocha test framework so the core technologies in which you would develop your web test automation are Java Script on top of Mocha.
    It is a test automation tool that enables developers to automate web browser testing.
    The Selenium WebDriver protocol enables sending commands in various development languages like Java, Java Script, C#, Python, and others from the test environment (IDEs) to a selected desktop browser (Chrome, Firefox, Edge, Safari).
    -----------------------------------------------------
    👪 Join our Community - bit.ly/learntes...
    ✅ Automation Community - thetestingacad...
    🐦Follow us on Twitter - / itstechmode
    📖 Like us on Facebook - / scrolltest
    🎤 Listen to our Podcast - anchor.fm/thet...
    ------------------------------------------------------
    #automationtesting #manualtesting #testautomation #thetestingacademy #scrolltest
    🚀 Tools and services I recommend:
    Some of the courses that I recommend to become better Automation Tester 🙌🙌
    ✅Selenium Training and Certification -
    scrolltest.com...
    ✅Learn Jenkins for QA -
    bit.ly/learnje...
    ✅Programming Java -
    bit.ly/learnja...
    ✅Test Automation -
    bit.ly/learnau...
    ✅API Testing -
    www.learnapite...
    ✅Cypress Tutorial with LIVE Projects -
    cypresstutorial...

Komentáře • 64

  • @kseniagolak
    @kseniagolak Před rokem +1

    Thank you very much for a great video, wish you luck and a lifetime of happiness! :)

  • @mukut999
    @mukut999 Před 4 lety +3

    Hi Tutor, Thank u so such for the video, just wanted to ask about how to connect DB using cypress.

  • @diybysobi163
    @diybysobi163 Před 2 lety +1

    Could you please teach us api automation with Cypress using page object model. How to get token from sign up and how to use in other api's.

  • @diybysobi163
    @diybysobi163 Před 2 lety +1

    HI sir can you please teach us how to automate authenticated api's in Cypress using page object model. Can you please show us an example in which you get (return token) token from sign up POST api and use it in some other class or page for next api. I am able to get that token on same page in same class but facing issue when trying to get on some other class/page.

  • @romanasheikh3983
    @romanasheikh3983 Před 2 lety

    Your videos are great, thanks so much

  • @istvan368
    @istvan368 Před rokem

    Thank you very much! What would you say if I want to use Cypress for UI and API testing. Can I have only one framework with API and UI tests? Or do you recommend using Jest for API and Cypress for UI tests in the same framework? Thanks.

  • @abrarbaig5954
    @abrarbaig5954 Před 2 lety

    well sir

  • @canansaricelik5472
    @canansaricelik5472 Před 3 lety +2

    Hello, thanks for the tutorial, I need help on oauth 2.0 authentication with cypress. Can you show how to do that?

    • @TheTestingAcademy
      @TheTestingAcademy  Před 3 lety +1

      This should help - auth0.com/blog/end-to-end-testing-with-cypress-and-auth0/#Writing-tests-using-Cypress-Login-Command

  • @TechTutorialz99
    @TechTutorialz99 Před 2 lety

    Thank you.

  • @shirishcin
    @shirishcin Před 3 lety +1

    WHere do we specify the authorization with the call in cypress ?

  • @joaoviana6970
    @joaoviana6970 Před 3 lety

    Hi, I have a doubt, can you help me?
    So, I need to make a POST request but the API that I'm using need a API key. How to put this API key on cypress? I need this command :/

  • @orneltachekam8683
    @orneltachekam8683 Před rokem

    Good evening to you, Please I am trying to test the api rest of the backend of an application with cucumber and cypress. I would like to have the procedure to follow, I am blocked since two weeks on it.

  • @ranveermalhotra5650
    @ranveermalhotra5650 Před 2 lety

    Can we add a XML file as form data in cypress and how to dynamically change the XML files.for diff request diff form data XML.file?

  • @SouthysFishing
    @SouthysFishing Před 4 lety +1

    what are the benefits of using this over postman? as I see you have postman open too.

    • @TheTestingAcademy
      @TheTestingAcademy  Před 4 lety +2

      With code you have more freedom to perform API Testing and You can avoid limitation of Postman

    • @soulful2665
      @soulful2665 Před 4 lety

      Sample e.g if you want to decode/encode the OAuth token for ur request header(base 64, SHA algorithms), it's easy to do it from code but from postman it's manual work
      Many more advantageous. Postman is to check any new api not good for complete API automation

    • @okeswarareddy438
      @okeswarareddy438 Před 4 lety

      @@TheTestingAcademy what is the limitation of postman

  • @shivam1427
    @shivam1427 Před 4 lety +1

    Thank you for the tutorial. I have a doubt:
    I can get the body for the entire response using cy.log(response.body.data) if I am using the endpoint used by you in the video.
    However, if I use my applications endpoint, then I don't get data in the response. I get object like this:
    object{4}
    id:2898
    name: "xyz"

  • @manikanthapothuri1029
    @manikanthapothuri1029 Před 4 lety +1

    how to validate response against database ?

  • @priyankawadodkar5681
    @priyankawadodkar5681 Před 4 lety

    Can guide for SSO login authorization where fir particular user token is generated and cookie is set to perform further operation once logged in through cypress how to automate this scenario

  • @EnochMaheshsilva
    @EnochMaheshsilva Před 3 lety

    HI, Thanks for the video, I'm new to Cypress, just want to know, how can I get a value from a POST response (Save as a variable) and pass it as a parameter in another service (GET) ?

    • @blackmetalmike
      @blackmetalmike Před 2 lety +1

      Here is a small code snippet that may help. I am new to Cypress and I had a similar question as you. To solve it I made a variable called 'fileId' which equals the value of 'response.body[0].id' so that value could be a number like '25'. I then add the value of '25' onto then end of my POST request lower down. You will see the POST request contains the url AND the fileId variable. So it would actually be /api/file/securitycontrol/25. Hope that makes sense
      .then((response) => {
      let fileId = response.body[0].id
      cy.request({
      method: 'POST',
      url: '/api/file/securitycontrol/' + fileId,

    • @EnochMaheshsilva
      @EnochMaheshsilva Před 2 lety +1

      @@blackmetalmike Thanks buddy, I will try this out.

  • @sanjeev8720
    @sanjeev8720 Před rokem

    Hi sir ..could you please explain how to handle new window functionality in Cypress

    • @TheTestingAcademy
      @TheTestingAcademy  Před rokem

      New tab supported is yet not added

    • @sanjeev8720
      @sanjeev8720 Před rokem

      @@TheTestingAcademy Sir can you please make a video on CICD pipeline by using gitlab in Cypress

  • @pushpanjalianjali3642

    How to add cookie in the header ??

  • @Ashokkumarg8
    @Ashokkumarg8 Před 3 lety

    What is your suggestion on this two to choose anyone.
    1. Karate API
    2. Cypress API

  • @hennaniahadri-koussa7330

    Hi, thanks for tutorial, i need help i am creating an promotion and i am getting the id, want to pass it to the next it block to get the promotion by id, but it never find that id

  • @romanasheikh3983
    @romanasheikh3983 Před 2 lety

    @thetestingacademy could you please help me passing api key in the header response, i am current getting 401 error

    • @TheTestingAcademy
      @TheTestingAcademy  Před 2 lety

      Thanks a lot for contacting, shoot us a email at : contact@thetestingacadey.com

  • @01wanant
    @01wanant Před 3 lety

    Can you please explain how to wait for graphql response using cypress?

  • @Pingsmingu
    @Pingsmingu Před 3 lety

    can you please add an example of passing a token from one request to other

  • @elizzasusan
    @elizzasusan Před 4 lety

    How can we maintain POJOS in cypress for request/response serialisation and de-serialisation?

    • @Pramod_Dutta
      @Pramod_Dutta Před 3 lety

      Why You want to maintain pojo, You can use jsons directly

  • @alexsr9697
    @alexsr9697 Před 4 lety

    How can I save the response.body on a variable ?
    I had try but was it impossible to use outside of that function : /

    • @TheTestingAcademy
      @TheTestingAcademy  Před 4 lety +1

      You can use in a global variable and create a callback when response.body is available then call your other function

    • @mathigowthaman7341
      @mathigowthaman7341 Před 4 lety

      @@TheTestingAcademy Can you please post an example of storing one element of json in a varialbe.

    • @thedan2333
      @thedan2333 Před 4 lety

      you can also chain .then promises

  • @kumarsaheb
    @kumarsaheb Před 4 lety

    Please increase the volume while recording , it is too less

    • @marcgood1855
      @marcgood1855 Před 4 lety

      More so, the fonts are too small to read. Too much white space so make them BIGGER, please, when recording. It was a poor user experience.

    • @TheTestingAcademy
      @TheTestingAcademy  Před 4 lety +1

      Watch in HD, will take care next time

  • @athribharadwaj1066
    @athribharadwaj1066 Před 4 lety

    Please make a video on image upload using a post request

  • @pratheepkumar4218
    @pratheepkumar4218 Před 4 lety

    Is cypress is open source.

    • @TheTestingAcademy
      @TheTestingAcademy  Před 4 lety

      Yes, but few of the things are not still open source.

    • @TheTestingAcademy
      @TheTestingAcademy  Před 4 lety

      @Mishal Alexander Some of the firefox , IE related support is still closed source.

  • @animeshkr29
    @animeshkr29 Před 4 lety

    Could you please give sample source code

    • @TheTestingAcademy
      @TheTestingAcademy  Před 4 lety

      You can follow along and create it by own.

    • @animeshkr29
      @animeshkr29 Před 4 lety

      @@TheTestingAcademy then why you are saying sample code I will give in this video , if you can't give then do not tell as well

  • @pritamjadhav4082
    @pritamjadhav4082 Před 2 lety

    U r just writing.. Please try to explain the things

  • @ulrichornelkengnetachekam1533

    Good evening to you, Please I am trying to test the api rest of the backend of an application with cucumber and cypress. I would like to have the procedure to follow, I am blocked since two weeks on it.