Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

268
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!