简体   繁体   中英

Receiving value from another column in SpecFlow Feature file with Examples

I'm writing BDD Tests with SpecFlow in c#. I'm trying to, in a beautiful way, take the value of one of the columns and use it as input to another column. Code:

Examples:
| volume    | error |
|  0        | Volume must be greater than 0 but is <volume> | 

I'd like <volume> to take the value 0 in this case. Is this possible? This is obviously not working at the moment. Thanks :)

No, it is not possible. One could argue that the connection between the two volume values would be more noticeable, easier to understand, but if you actually substitute 0 in this case, it will be perfectly understandable. If you do want to emphasize the connection, you could write another scenario outline along the lines:

Given the volume has been set to <volume>
When action is triggered
Then the error message should be "Volume must be greater than 0 but is <volume>"

And then all your examples with nonpositive numbers.

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