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

274
Vistas
Passing parameters in cucumber background

How can I pass variables in cucumber background like we pass in our scenario.

We can group repetitive steps under a Background section in cucumber.

As per my scenario i have to login several times to test for diff templates; so i am keeping my login process in background but I don't want to hardcode it instead i want to put username and password in an excel sheet and then get it from there.

Ex:

 Feature:  UI Testing
 
   Background: User log-in
     Given I am on the login page
     When I enter email "test00@ex.com"
     When I enter password "tests123"
     When  I click on sign in button
     Then  I should see home page
 
   Scenario: create template 1
     When I Click on the templates-1
     When I fill in the required details and click create
     Then I validate template is created successfully
     Then I should click sign out button
 
   Scenario: create template 2
     When I Click on the templates-2
     When I fill in the required details and click create
     Then I validate template is created successfully
     Then I should click sign out button
 
   Scenario: create template 2
     When I Click on the templates-3
     When I fill in the required details and click create
     Then I validate template is created successfully
     Then I should click sign out button

something like this:

Background: User log-in
    Given I am on the home page
    When I enter <email>
    When I enter <password>
    When  I click on sign in button
    Then  I should see home page
    Examples:
      | email    | password   |
      | A2       | C3         | 

(A2 and C3 are cells of excel sheet)

How can I pass my email and password as parameter in background. Does it support Example, or data table to feed the excel sheet. or any other alternative. Can anybody give me pointer to achieve that.

Thanks in advance.

about 4 years ago · Juan Pablo Isaza
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