It seems odd that in 2011 there is no such thing as a requirements capture language.
When I am building code it is ludicrous that I need to read a perpetually changing 50 page Word document or Excel spreadsheet, or worse a set of UML diagrams that are totally disconnected from reality.
We need a standardized language which is simple and unambiguous, human readable, editable and tool-able, that hooks into an entity dictionary, and that supports traceability. Even better would be something I could use as a loose set of constraints that I could compile against, but I am not interested in the complexity and unwieldiness of a Formal Specification language – I don’t need to run a theorem prover over my code.
so what are my options for requirements capture?
TFS Work Items – Create a parent Scenario work item which links to many task work items. Analysts need a tool to capture requirements, not a development or QA environment - can use TFS Excel or Project integration. Although a Scenario Work Item could be considered a requirement, and does provide tracability, the actual requirement text is not structured.
RavenFlow (
http://www.ravenflow.com ) - uses NLP to parse a document and guess what UML to generate (innovative, but immature)
Drools -
http://droolsdotnet.codehaus.org/ - an XML based syntax for Rete Rule Engine rules. I suppose part of the system could be captured as a rule engine, but there is more to requirments than this.
BDD (Given ... When ... Then) - at first glance, seems immature and Ruby centric.
NGourd for C# (
http://code.google.com/p/ngourd/ ) requires svn client to get source from github and compile , and then you run from command line - immature. Can you imagine a non-technical analyst writing requirements like this?
and
SpecFlow is a VSIX that installs project templates and seems capable of generating BDD tests from .feature files.
So BDD to the rescue - My goal is to generate GWTs from TFS Work Items, and let SpecFlow do the rest. I could see a simple markup syntax, with Regex input prefixes for guidance: E for Entity, A for Action, P for Property and V for Value:
I added an XML file to my scratchpad solution:
<Scenario>
<Givens>
<Given> the [E:Account] [P:Status] is in [V:Credit] </Given>
<Given> the [E:Card] is [V:Valid] </Given>
<Given> the [E:Dispenser] Has [P:Cash] </Given>
</Givens>
<Whens>
<When> [E:Customer] [A:Request]s [P:Cash] </When>
</Whens>
<Thens>
<Then>Ensure [E:Account] is [A:Debit]ed </Then>
<Then>Ensure [E:Cash] is [A:Dispense]d </Then>
<Then>Ensure [E:Card] is [A:Return]ed </Then>
</Thens>
</Scenario>
I generated a schema from this using the Visual Studio XML > Create Schema menu:
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Scenario">
<xs:complexType>
<xs:sequence>
<xs:element name="Givens">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Given" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Whens">
<xs:complexType>
<xs:sequence>
<xs:element name="When" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Thens">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Then" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
In part 2 of this post I will look into:
- a TFS Work Item Type (WIT) to contain this GWT data
- an Editor Tool for analysts to add BDD Scenario WITs to TFS
- a T4 for extracting data from GWT WITs and generating SpecFlow .feature files - so that SpecFlow can generate the tests (and using T4, possibly the Models)