I am new to Specflow so here goes;
For my example below Should I test for the bad at all? If I do the table won't let you add a bad value. So the code will error because its coming in as as bad type. I guess I just need to know how others handle verifying the user can't enter bad data? (fields names are changed due to confidential info) the requirement says:
Verify that the user cannot set the rate to be negative or greater than 1. The rate range is from 0.9999 to 0.
Verify that the user cannot enter a rate with more than 4 decimal places.
Given the lc does not exist
| Lc |
| Test90 |
| Test00 |
When I add a Lc
| Lc | Somekind of ID| Rate |
| Test90 | 2 | 0.9999 |
| Test00 | 4 | 0 |
Then the lc should be defined
| Lc |
| Test90 |
| Test00 |
It's a bit strange that you are testing 2 values thoughout your test.
I would be tempted to rewrite like this:
Scenario Outline: valid lc's can be created
Given the lc named <lc> does not exist
When I add a Lc named <lc> with Id <id> and rate <rate>
Then the lc named <lc> should be defined
Examples:
| Lc | Id | Rate |
| Test90 | 2 | 0.9999 |
| Test00 | 4 | 0 |
Scenario Outline: Invalid lc's cannot be created
Given the lc named <Lc> does not exist
When I add a Lc named <Lc> with Id <Id> and rate <Rate>
Then the lc named <Lc> should not be defined
And an error should have been raised saying the rate was invalid
Examples:
| Lc | ID | Rate |
| Test90 | 2 | 1.999 |
| Test90 | 2 | 0.99999 |
| Test90 | 2 | -0.9 |
| Test00Y | 4 | 6 |
| Test00Y | 4 | |
The And an error should have been raised saying the rate was invalid
step is obviously optional but shows that this is expected to fail due to an invalid rate.