View
7
Download
0
Category
Preview:
Citation preview
BDD (behavior-driven development) suunnittelumenetelmän käyttö open
source projektissa, case: SpecFlow/.NET.
Pekka Ollikainen
Open Source Microsoft CodePlex
bio
• Verkkosivustovastaava Suomen Sarjakuvaseura ry alk. 08/2013
• Web-ohjelmoinnin erikoistumisopinnot Arcada AMK 2009-2010
• HUK Tampereen yliopisto
Scripts for all Reasons 1
• Elokuvan tekemisen ja ohjelmistokehityksen samanalaisuuksia:
• Käsikirjoitus(script) vs. vaatimusmäärittely(requirments)
• Storyboards vs. Mockups
• Digital film distribution vs. Distrobution via app stores
Scripts for all Reasons 2
• Käsikirjoitus/vaatimusmäärittely dokumentit kertovat millainen elokuva/ohjelmisto halutaan tehdä ja miten
• Käsikirjoitus koostuu kohtauksista, vaatimusmäärittelyt featureista(feature) ja skenaarioista(scenarios)
• Käsikirjoituksella on muoto ja funktio
• Vaatimusmäärittelyllä muoto ja ohjelmistolla on funktio
Behaviour Driven Developement
• behavior-driven development (BDD) is a software development process based on test-driven development
• how software development should be managed by both business interests and technical insight
• use of specialized software tools to support the development process
Cucumber
• Gherkin language
• Documenting examples way that it can be easily understood both by stakeholders and by Cucumber
• Gherkin can be call a programming language but its primary goal is human readibility
• Write automate tests that can be read like documentation
Gherkin syntax
• Structure and meaning using set of special keywords
• Feature
• Background
• Scenario
• Given
• When
• Then
Cucumber:Living documentation
• Living: Cucumber testaa kehitettävää järjestelmää jatkuvasti automaattisesti, että se toimisi kunnolla kun otetaan lopulta käyttöön..
• Documentation: Cucumber fasiloi hyvän keskustelun/kommunikaation siitä, miten sovellus toimii nyt ja miten se pitäisi toimia jatkossa..
Esimerkkikoodia Feature: Write blog
As a blog owner
I can write new blog post
Scenario: Write blog
Given I am on the blog homepage
When I click "New Post" link
And I fill "My first blog" as Title
And I fill "Test content" as content
And I click "Post" button
Then I should see the blog I just posted
Esimerkkikoodia Feature: Credit card payment
As a online shopper
I want to pay through my Credit card
So that I can buy stuff online instead of
visiting the super market
Scenario: transaction completed
successfully
Given ...
When ...
Then ...
Scenario: Credit card is invalid
Given ...
When ...
Then ...
How Cucumber executes a
scenario
Write scenario at Gherkin
Add SpecFlow Library
GenerateStepDefinition
Does the Step definitions have matching C# code?
FAIL!!Test Execution Report
Calling for Matching C#Code..
How to apply MVC to Mobile
• Applying MVC to mobile projects http://senchaproject.codeplex.com/wikipage?title=How%20to%20apply%20MVC%20to%20mobile%20project&referringTitle=Home
Our scenarios
Scenario:Android device Given Android access the application And OS configuration N When Switcher is On Then UI will be rendered with UI library X Scenario:iPhone device Given iPhone access the application And OS configuration N When Switcher is On Then UI will be rendered with UI library Y Scenario:Windows phone device Given Windows phone access the application And OS configuration N When Switcher is On Then UI will be rendered with UI library Z
Project statistics
History
lähteet:
• CODEMagazine, May/June 2013
• Instant Cucumber BDD How-to, Packt 2013
• The Cucumber Book, The Pragmatic Programmers,2012
• Cucumber Recipes, The Pragmatic Programmers,2013
• Projektiyhdistys/PRY/Projektitoiminta 1/2013
Johtopäätöksiä Cucumber
• Luonnollinen kieli ja keskustelun rakenteet ohjelmistosuunnittelun lähtökohtana
• ”demokraatinen”suunnittelukieli
• +Vaihteittainen työskentelymalli
• -käyttöönotto ohjelmistohankkessa ei yksinkertaista
Recommended