Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

269
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda