Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

97
Vistas
Cypress: run entire test suite multiple times with different data

I have seen several posts about running a single test with different parameters. It is also documented here.

However, I couldn't find any examples of how to run the entire test suite, i.e. tests across multiple files in the cypress/integration folder multiple times with different data.

My scenario is that I want to stub different responses from an API I'm calling and run all test cases against the different responses. So for the 1st run, I would put in support/index.js:

beforeEach(() => {
  cy.intercept("GET", "example/API", { fixture: "fixture1.json" });
});

and for the 2nd run I would put:

beforeEach(() => {
  cy.intercept("GET", "example/API", { fixture: "fixture2.json" });
});

and so on. All my test cases are identical for different responses and I expect them to have the same result regardless of the data returned by the API.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Running a suite with different parameters

cypress run --env fixture=fixture1
// or
cypress run --env fixture=fixture2

Ref Environment Variables

In support/index.js

beforeEach(() => {
  const fixtureName = `${Cypress.env('fixture')}.json`
  cy.intercept("GET", "example/API", { fixture: fixtureName });
})

I expect them to have the same result regardless of the data returned by the API - I'm not sure what that means exactly but to me it suggests you don't have to worry about changing the fixture.


If you want a single call from the command line to run the whole suite, say 3 times with a different fixture each time, consider using the Cypress Module API

In a script file, e.g /scripts/run-fixtures.js

const fixtures = ['fixture1.json','fixture2.json','fixture3.json']  

const cypress = require('cypress')

fixtures.forEach((fixtureName) => {

  cypress.run({
    reporter: 'junit',
    browser: 'chrome',
    config: {
      baseUrl: 'http://localhost:8080',
      video: true,
    },
    env: {
      fixture: fixtureName,
    },
  })
})

Run it with node /scripts/run-fixtures.

support/index.js is the same as above.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda