How i wrote my own bdd framework

479 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
479
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

How i wrote my own bdd framework

  1. 1. How I Wrote My Own BDD Framework
  2. 2. Earlier last year... Revamped our Automated UAT Suite 5 Months to Develop 200 Files 7,000 LOC Pretty Reports
  3. 3. “Smelly Test Code” (eww)
  4. 4. “Because It’s There.” Photo by @topgold http://www.flickr.com/photos/44124366475@N01/4509103
  5. 5. Demo https://github.com/ManaManaFramework/demos
  6. 6. Some Stats 500+ lines of human-editable code 94.8% Ruby 5.2% Ragel 90% Code Coverage Ruby 1.9.3 and 2.0.0 i18n support out of the box
  7. 7. How It Works
  8. 8. How It Works RDSL Lexer RDSL Parser TDSL TDSL Lexer TDSL Parser Spec File Runner Step Defs Output RDSL Compiler
  9. 9. Lexing (aka Tokenizing) Analogy Dajalk j lkafjda V ljad jala l kajd ad eWwera 12 etq qowrer dSad we Dwlakd aDalkja akerkrjd Create a Project A user with a role of <Role> in the system <Can or Cannot Create> projects
  10. 10. Lexing (aka Tokenizing) Create a Project ================ * A user with a role of <Role> in the system <Can or Cannot Create> projects Examples: | Role | Can or Cannot Create | | Admin | Can Create | | User | Cannot Create | [ [:GROUP, 'Create a Project'], [:REQUIREMENT, 'Given a user has a role of ...'], [:TEXT, 'Examples:'], [:ROW, nil], [:CELL, 'Role' ], [:CELL, 'Can or Cannot Create'], [:ROW, nil], [:CELL, 'Admin'], [:CELL, 'Can Create'], [:ROW, nil], [:CELL, 'User' ], [:CELL, 'Cannot Create'] ]
  11. 11. Don’t Write Your Lexer in Ruby
  12. 12. How it Works Ragel Lexer Definition RDSL Lexer
  13. 13. Create a Project ================ * A user with a role of <Role> in the system <Can or Cannot Create> projects Examples: | Role | Can or Cannot Create | | Admin | Can Create | | User | Cannot Create | [ [:GROUP, 'Create a Project'], [:REQUIREMENT, 'Given a user has a role of ...'], [:TEXT, 'Examples:'], [:ROW, nil], [:CELL, 'Role' ], [:CELL, 'Can or Cannot Create'], [:ROW, nil], [:CELL, 'Admin'], [:CELL, 'Can Create'], [:ROW, nil], [:CELL, 'User' ], [:CELL, 'Cannot Create'] ]
  14. 14. [:GROUP, 'Create a Project'] Create a Project ================
  15. 15. RDSL Lexer RDSL Parser TDSL TDSL Lexer TDSL Parser Spec File Runner Step Defs Output RDSL Compiler
  16. 16. Lexing (aka Tokenizing) Analogy Dajalk j lkafjda V ljad jala l kajd ad eWwera 12 etq qowrer dSad we Dwlakd aDalkja akerkrjd Create a Project A user with a role of <Role> in the system <Can or Cannot Create> projects
  17. 17. Parsing Analogy Create a Project A user with a role of <Role> in the system <Can or Cannot Create> projects Create a Project A user with a role of <Role> in the system <Can or Cannot Create> projects
  18. 18. Parsing GroupNode.new('Create a Project', [ RequirementNode.new('Given a user has a role of ...', [ ExamplesNode.new([ RowNode.new(['Role', 'Can or Cannot Create']), RowNode.new(['Admin', 'Can Create']), RowNode.new(['User', 'Cannot Create']) ]) ]) ]) [ [:GROUP, 'Create a Project'], [:REQUIREMENT, 'Given a user has a role of ...'], [:ROW, nil], [:CELL, 'Role' ], [:CELL, 'Can or Cannot Create'], [:ROW, nil], [:CELL, 'Admin'], [:CELL, 'Can Create'], [:ROW, nil], [:CELL, 'User' ], [:CELL, 'Cannot Create'] ]
  19. 19. How it Works Racc Parser Definition RDSL Parser Racc Runtime
  20. 20. GroupNode.new('Create a Project', [ RequirementNode.new('Given a user has a role of ...', [ ExamplesNode.new([ RowNode.new(['Role', 'Can or Cannot Create']), RowNode.new(['Admin', 'Can Create']), RowNode.new(['User', 'Cannot Create']) ]) ]) ]) [ [:GROUP, 'Create a Project'], [:REQUIREMENT, 'Given a user has a role of ...'], [:ROW, nil], [:CELL, 'Role' ], [:CELL, 'Can or Cannot Create'], [:ROW, nil], [:CELL, 'Admin'], [:CELL, 'Can Create'], [:ROW, nil], [:CELL, 'User' ], [:CELL, 'Cannot Create'] ]
  21. 21. RDSL Lexer RDSL Parser TDSL TDSL Lexer TDSL Parser Spec File Runner Step Defs Output RDSL Compiler
  22. 22. Wish List
  23. 23. Hierarchical Requirements
  24. 24. Call Test from Test
  25. 25. Wait for Human Evaluation Do Something Display Output to Human Wait for Human Evaluation OK? Mark Test Passed Mark Test Failed
  26. 26. Oh, BTW...we’re hiring! Ruby Devs JavaScript/CSS/HTML5 Devs Project Managers email me at mark@morphlabs.com

×