Ahmed-Ali / Cucumberish

Cucumberish is test automation framework for Behaviour Driven Development. It is inspired by the amazing way of writing automated test cases introduced originally by Cucumber using Gherkin language
MIT License
344 stars 83 forks source link

Implement using data table when calling a step within a step definition #40

Open cyoungrbh opened 7 years ago

cyoungrbh commented 7 years ago

I'd like to be able to call a step within a step definition, but one that uses a data table. I've seen examples in Cucumber and Ruby, but not for this framework. Something similar to below, possibly?

        self.performStep("I enter this data into the following fields:", in: dataTable(%{
      | userValue | field   | 
      | myName   | input field  |)
Ahmed-Ali commented 7 years ago

We have a function called step (or SStep in Swift) which you can use for that. However, the trick will be to construct the matching string. I would recommend extracting the step implementation into a well formed method signature, and call that method instead. Because writing static strings inside your implementation might add extra confusion anyway.

brentleyjones commented 7 years ago

I think the issue @cyoungrbh is trying to say is there is no way to call step with a data table, since it's not part of the matching string. Seems step needs to take a data table as an optional argument.

cyoungrbh commented 7 years ago

Exactly, thanks Brentley.

brentleyjones commented 7 years ago

@Ahmed-Ali I looked into this as well and I agree with @cyoungrbh, it would be nice to be able to pass an array of arrays just like we get when a step definition is invoked by a scenario.

Ahmed-Ali commented 7 years ago

I will add this into consideration with the upcoming release (not the immediate soon-to-be-released version though). For now I will leave this issue open to avoid overlooking it.

Thanks guys!