Forum Discussion
TanyaYatskovska
5 years agoSmartBear Alumni (Retired)
Hi julien-le-foll,
Thanks for submitting your question to the CucumberStudio community. I was told that you are already working with the R&D team on this topic. Please continue working with them and share the solution with us.
- julien-le-foll5 years agoNew Contributor
Hello,
R&D replied me that they won't be able to fix it quickly.
For the time being here the workaround that I suggested to our dev team:
1/ use string parameter in feature files such as:
Feature: numeric arguments are lost Scenario Outline: show loss of numeric types Given a price of "<price>" And the price parameter is an int in step implementation When the scenario is uploaded to cucumberStudio Then the price parameter becomes a string Examples: | price | | 30 | | 40 |
2/ Parse strings in step's implementation:
@Given("a price of {string}") public void a_price_of(String sInt1) { int int1 = Integer.parseInt(sInt1); //.... }
- julien-le-foll5 years agoNew Contributor
Hello,
Finally your R&D show me a better solution:
- In CucumberStudio set 0 as default value for numeric parameter (add = 0)
- and the following step implementation can be used:
@Given("a price of "(.*)"$") public void a_price_of(double price) { //.... }
The deal is that numeric types can't be used in annotations but it is acceptable
- TanyaYatskovska5 years agoSmartBear Alumni (Retired)
It's great to hear that the solution was found!
Related Content
Recent Discussions
- 18 days ago
- 5 months ago
- 6 months ago
- 6 months ago