Skip to main content

Cucumber Sending Test Data in Steps using multiple arguments

We sends different types of data using Steps. Steps sends data in form of string, integer or double which can be received in step definition in multiple ways. In your steps you pass data inside double quotes(" "). The text mentioned in between " " in steps is associated to capture groups in Step Definition files.

You can receive even more complex data using Data Table and Scenario outline in Cucumber.

How to pass multiple parameters in cucumber feature file

In a single step you can even pass more than one argument. Consider below Scenario here in first step (When I fill...) we are sending two arguments.

Scenario: Verify Login Functionality
  When I fill email with "" and password with "1234"  
  And I click on Sign in 

Check below how this data received in step definition

@When("I fill email with {string} and password with {string}")
public void i_fill_email_with_and_password_with(String string1, String string2) 

You can pass even int, double or any other value in Steps. Example: Check below step

When I enter price 1234.54

 Corresponding Step Definition will be

@When("I enter price {double}")
public void i_enter_price(Double double1) {


Similarly we can use int for integer.

Submitted by tgoswami on August 30, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.