Online Exam Quiz

questionQuestion  1 to 30

How do you test the status code of an API response in Cypress?

  • .should('have.status')
  • .should('equal')
  • .should('be.equal')
  • .should('have.code')
Mark for review

What is the default method for cy.request() in Cypress?

  • POST
  • GET
  • PUT
  • DELETE
Mark for review

How do you test the POST request body in Cypress?

  • .should('equal')
  • .should('include')
  • .should('contain')
  • .should('have.deep.property')
Mark for review

What is the correct way to authenticate API requests in Cypress with a Bearer token?

  • cy.authenticate()
  • cy.setToken()
  • cy.request({ headers: { Authorization: Bearer ${token} } })
  • cy.useAuth()
Mark for review

How do you test the status code for a failed request in Cypress?

  • .should('be.gt', 400)
  • .should('have.status', 404)
  • .should('equal', 404)
  • .should('match', 404)
Mark for review

How do you verify that the API request contains specific headers in Cypress?

  • .should('have.property', 'headers')
  • .should('include', 'header')
  • .should('have.keys', 'header')
  • .should('contain.property', 'header')
Mark for review

What is the purpose of cy.request().then() in Cypress API testing?

  • To wait for the response
  • To assert the response body
  • To chain multiple actions after the request
  • To handle request failures
Mark for review

Which method helps you check if an API response contains a specific string?

  • .should('contain')
  • .should('equal')
  • .should('be.equal')
  • .should('include')
Mark for review

How do you send data with a GET request in Cypress?

  • cy.request({ method: 'GET', body: {...} })
  • cy.request({ method: 'GET', query: {...} })
  • cy.get()
  • GET requests do not send body data
Mark for review

In Cypress, how can you check if an API returns a specific field?

  • .should('have.property')
  • .should('contain')
  • .should('have')
  • .should('field')
Mark for review

How do you test for the response headers in Cypress?

  • .should('have.property', 'headers')
  • .should('have.keys', 'headers')
  • .should('contain', 'headers')
  • .should('include', 'headers')
Mark for review

What is the correct way to test API responses in Cypress?

  • Use cy.assert()
  • Use cy.request()
  • Use cy.api()
  • Use cy.query()
Mark for review

How can you test if an API response returns a correct string value in Cypress?

  • .should('be.string')
  • .should('contain')
  • .should('match')
  • .should('equal')
Mark for review

How do you test API responses that include dynamic data in Cypress?

  • Use cy.stub()
  • Use cy.mock()
  • Use cy.request() with dynamic parameters
  • Use cy.intercept()
Mark for review

How do you handle response data as JSON in Cypress?

  • .response().json()
  • .request().json()
  • .its('body').should('be.json')
  • .response().toJSON()
Mark for review

How do you assert a successful POST request in Cypress?

  • .should('have.status', 200)
  • .should('have.status', 201)
  • .should('equal', 200)
  • .should('contain', 'success')
Mark for review

How do you simulate a successful 200 status code response in Cypress?

  • cy.route({ status: 200 })
  • cy.stub({ status: 200 })
  • cy.request() with status 200
  • Use cy.response()
Mark for review

What is the role of cy.intercept() in Cypress API testing?

  • It waits for the request to finish
  • It mimics requests and responses
  • It verifies the API response status
  • It simulates browser events
Mark for review

How do you perform assertions on multiple API responses in Cypress?

  • Use cy.wait()
  • Use cy.all()
  • Use cy.then()
  • Use cy.parallel()
Mark for review

Which method in Cypress is used to send POST requests?

  • cy.postRequest()
  • cy.send()
  • cy.request()
  • cy.submit()
Mark for review

How do you chain multiple assertions in Cypress?

  • Use cy.then()
  • Use .should() on each assertion
  • Use cy.chain()
  • Use cy.combine()
Mark for review

How do you ensure the response body is not null in Cypress?

  • .should('not.be.null')
  • .should('exist')
  • .should('not.have.property', 'null')
  • .should('not.equal', null)
Mark for review

What is the default timeout for a Cypress API request?

  • 5000 ms
  • 4000 ms
  • 10000 ms
  • 6000 ms
Mark for review

How do you verify the response body in Cypress?

  • cy.body()
  • cy.response()
  • cy.json()
  • cy.should()
Mark for review

How do you mock the response for specific HTTP status codes in Cypress?

  • cy.stub() with HTTP status
  • cy.route() with status codes
  • cy.request() with status codes
  • cy.status()
Mark for review

How can you verify that the response body matches a JSON structure in Cypress?

  • .should('have.json')
  • .should('deep.equal', { ... })
  • .should('be.json')
  • .should('contain', 'json')
Mark for review

How do you simulate an error in an API response using Cypress?

  • Use cy.route() with error response
  • Use cy.stub() with error response
  • Use cy.request() with error status code
  • All of the above
Mark for review

How can you perform an API request with a query parameter in Cypress?

  • cy.request({ method: 'GET', params: { id: '123' } })
  • cy.query({ method: 'GET', params: { id: '123' } })
  • cy.get()
  • cy.request({ method: 'GET', query: { id: '123' } })
Mark for review

How do you handle API errors in Cypress?

  • Use cy.on('error')
  • Use cy.expect()
  • Use cy.request().fail()
  • Use cy.catch()
Mark for review

How can you capture the response body of an API in Cypress?

  • cy.request().its('body')
  • cy.get().response()
  • cy.capture()
  • cy.response().body()
Mark for review

blinkerOnline

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • Answered
  • Not Answered
  • Marked for Review