[Cucumber:10601] Cuking it Right -- Large Contexts
So I'm continually in search of how to "Cuke it Right" and I keep
stumbling over things when you have applications that are more complex
than your average shopping cart. What I'm hoping to do here is have
any and all critique what I present and tell me where I'm either doing
it wrong or missing an approach that I should be using.
Here's the context:
(1) I work on an application that has Plans that are associated with
Studies. Different studies may cause different default values in the
plans.
(2) We currently have no "gold data" -- meaning data I can rely on
being in place. The idea is that our tests create all data conditions.
Here's the intent of the tests:
(1) When a plan is associated with a study that is set up as phase 4,
the default values on plans should be checked.
(2) When a plan is associated with a study that is set up as anything
other than phase 4, the default values on plans should be checked.
As you can guess, the defaults differ based on the plan->study
association.
So here is an example of what I came up with just for the context
(meaning the Given):
============================
Feature: Changes to Plans Based on Study Phase
Background:
Given a new study with
| Name | Test Study 1 |
| Phase | 4 no IND |
And a new study with
| Name | Test Study 2 |
| Phase | 2 |
Given a new plan with
| Name | Test Plan 1 |
| Location | USA |
| Number of Sites | 10 |
| Subjects to Randomize | 10 |
| Avg Grant Amount | 100
| MOH/FDA Delay | 0 |
| Location | Canada |
| Number of Sites | 10 |
| Subjects to Randomize | 10 |
| Avg Grant Amount | 100
| MOH/FDA Delay | 0 |
And a new plan with
| Name | Test Plan 2 |
| Location | USA |
| Number of Sites | 10 |
| Subjects to Randomize | 10 |
| Avg Grant Amount | 100
| MOH/FDA Delay | 0 |
| Location | Canada |
| Number of Sites | 10 |
| Subjects to Randomize | 10 |
| Avg Grant Amount | 100
| MOH/FDA Delay | 0 |
============================
Yikes, huh? But that is the full context needed for the tests. I need
two studies and I need two plans. One study has a specific type of
phase and the other study has a different one. The two plans are
needed because each plan will have to be associated with one of the
studies. Specifically:
Test Plan 1 associated with Test Study 1
Test Plan 2 associated with Test Study 2
The locations are important because those are part of what are being
checked as part of the test.
Originally I tried to provide a sort of "signature" to make the
context shorter, like this:
============================
And a new plan with
| Name | Test Plan 2 |
| Location | USA | 10 | 10 | 100 | 0 |
| Location | Canada | 10 | 10 | 100 | 0 |
============================
Here the location lines would be "signatures" for values. In other
words, the "convention" is that if the row starts with Location, the
next cell must be the country and the next four cells will be defined
behind the scenes. But that doesn't work, of course, because then I
have differing columns.
Hopefully I've provided enough context for why I came up with what I
did above. What I'm curious about is what I could have done better or
even entirely differently.
I haven't even gotten to the When and Then yet because I'm worried
about inundating this post. But just so you all have some context,
here is what a typical When-Then looks like when used with the above
context:
============================
Scenario: Verify defaults on Site tab
When the Site tab is viewed on plan named "Test Plan 1"
Then the following fields will have the following values:
| Percent of sites identified by sponsor:
| 100 | 20 |
| Percent of sites requiring a pre-study site visit (in-person):
| 0 | 0 |
| Percent of sites requiring site initiation visits (in-person):
| 0 | 0 |
| Percent of onsite close-out visits:
| 0 | 0 |
| Percent of sites requiring a QA audit:
| 0 | 0 |
| Percent of sites using BOTH a central and a local IRB/EC:
| 0 | 0 |
| Percent of sites using ONLY a central IRB/EC:
| 0 | 0 |
| Percent of sites using ONLY a local IRB/EC:
| 0 | 0 |
============================
There would be another scenario that verifies the Site tab on Test
Plan 2. Those long names you see there in the first column are the
actual names of the labels in our application. Testers are asked to
put them in exactly because it cuts down on guesswork regarding how
much or how little of the label to put in place.
I know this is a long example and a lot to parse through but if anyone
has any ideas, I'm certainly willing to listen.
- Jeff
--
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes@...
To unsubscribe from this group, send email to cukes+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.