简体   繁体   中英

Is there any way to send data from Java step definition class to feature file in Cucumber framework?

If it is possible to send data from java step definition class to Feature file, It will be useful for me.

Kindly help in this.

As per my understanding you need to have support for step returning value. As far as i know gherkin with cucumber doesn't support it. However Gherkin with QAF supports step with return value and facilitates a way to use it inside bdd or in code. For example:

@Given("doing some actions")
public Object myStepReturningValue() {
   //do the needful
   return object;
}

In BDD:

Given doing some actions
And store into 'action.result'
...
Then using '${action.result}' do something

You can use any of the supported BDD syntax including Gherkin which supported by cucumber.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM