\$\begingroup\$
\$\endgroup\$
1
I am new to BDD/Specflow and was wondering if I could get some feedback on my definitions
Here is what I have for a simple customer creation feature/command:
Scenario: Creating a customer with an account number that already is used
Given a customer already exists with the account number CUSTOMER001
When I try to create a new customer with same account number
Then the system should say that an account number must be unique
Scenario: Creating a customer with a name that already is used
Given a customer already exists with the name Customer01
When I try to create a new customer with same name
Then the system should say that a customer name must be unique
Scenario: Creating a customer with a name that already is used (lowercase)
Given a customer already exists with the name Customer01
When I try to create a new customer with name customer01
Then the system should say that a customer name must be unique
Scenario: Creating a customer
Given no customer exists with the account number CUSTOMER001
And no customer exists with the name Customer01
When I try to create a new customer the account number CUSTOMER001 and name Customer01
Then that customer should be created
I have a few questions:
- For the last test (the success test) where a customer is created, the when seems overloaded, because I am specifying both parameters. is this fine?
- Because business code usually is guarded, I have the failure tests then a successful one. The successful one seems it might be overloaded as it says the reverse of each failure criteria, is this ok (e.g. no customer exists with number, no customer exists with name, etc..) Should I say instead something else? No customer exists would work, but that isnt going to ever be a real example
Any general feedback would be massively helpful as I am really new to this
Greg Burghardt
5,96914 silver badges26 bronze badges
-
\$\begingroup\$ I never thought about gherkin being a candidate for a code review. I like it, though. I changed the title to include what this code does (defines the behavior around creating customers). \$\endgroup\$Greg Burghardt– Greg Burghardt2022年03月29日 00:23:48 +00:00Commented Mar 29, 2022 at 0:23
lang-cs