Online Exam Quiz

questionQuestion  1 to 30

Which Cypress command is used for simulating HTTP requests?

  • cy.stub()
  • cy.route()
  • cy.request()
  • cy.query()
Mark for review

How do you simulate a 404 error in Cypress API tests?

  • cy.route() with status 404
  • cy.stub() with status 404
  • cy.request() with status 404
  • Cypress does not support 404 errors
Mark for review

What Cypress command allows you to change request body data dynamically?

  • cy.body()
  • cy.sendData()
  • cy.fixture()
  • cy.request()
Mark for review

How do you assert that an API response contains a header with a specific value in Cypress?

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

What is the default timeout for Cypress API requests?

  • 10000 ms
  • 5000 ms
  • 15000 ms
  • 2000 ms
Mark for review

What is the best way to assert response content in Cypress?

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

How can you verify the API response body is an array in Cypress?

  • .should('be.array')
  • .should('have.length')
  • .should('be.json')
  • .should('contain', 'array')
Mark for review

How can you verify an API response is JSON and contains a specific field?

  • .should('be.json') and .should('have.property')
  • .should('contain.json') and .should('include.property')
  • .should('equal.json') and .should('be.deep')
  • .should('match.json') and .should('include')
Mark for review

How can you validate if an API response body matches a fixture file in Cypress?

  • cy.match()
  • cy.fixture().should('equal')
  • cy.request().its('body').should('deep.equal')
  • cy.compare()
Mark for review

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

  • cy.expect()
  • cy.assert()
  • cy.should()
  • cy.status()
Mark for review

What method is used to handle a failed request in Cypress?

  • .should('fail')
  • .catch()
  • .then()
  • .should('be.false')
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

What should you use to intercept an API request made by a page before it completes in Cypress?

  • cy.route()
  • cy.stub()
  • cy.get()
  • cy.intercept()
Mark for review

How can you verify if the response body contains a nested object in Cypress?

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

How do you handle API timeouts in Cypress?

  • cy.request() with timeout option
  • cy.wait() with timeout option
  • cy.pause() with timeout option
  • Use cy.setTimeout()
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 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

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

How can you send a PUT request in Cypress?

  • cy.putRequest()
  • cy.send()
  • cy.updateRequest()
  • cy.request()
Mark for review

How can you mock an API response in Cypress using a fixture?

  • Use cy.fixture()
  • Use cy.stub()
  • Use cy.mock()
  • Use cy.response()
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 can you add authentication tokens to your API requests in Cypress?

  • cy.addToken()
  • cy.request({ auth: {...} })
  • cy.setToken()
  • cy.useAuth()
Mark for review

Which of the following is used to mock an API response in Cypress?

  • cy.mock()
  • cy.spy()
  • cy.route()
  • cy.intercept()
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 do you pass parameters in a URL for Cypress API requests?

  • Use cy.request({ url: 'api/{id}', params: {...} })
  • Use cy.request({ url: 'api?id={id}' })
  • Use cy.query()
  • Use cy.get()
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

What is used to handle delays in API requests in Cypress?

  • cy.wait()
  • cy.delay()
  • cy.pause()
  • cy.waitFor()
Mark for review

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

  • .should('have.size')
  • .should('have.length')
  • .should('contain')
  • .should('have.property', 'length')
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

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

  • .should('have.responseTime')
  • .should('be.lt', 200)
  • .should('have.property', 'responseTime')
  • .should('be.gt', 1000)
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