Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bilelmsekni/harrypotter-kata
https://github.com/bilelmsekni/harrypotter-kata
bdd dotnet java jbehave kata specflow
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/bilelmsekni/harrypotter-kata
- Owner: bilelmsekni
- Created: 2016-04-06T06:11:17.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-10T09:21:30.000Z (over 7 years ago)
- Last Synced: 2024-11-10T11:54:46.332Z (3 months ago)
- Topics: bdd, dotnet, java, jbehave, kata, specflow
- Language: C#
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Harry Potter Kata BDD
===============================This Kata will help candidates learn about BDD development.
The .Net version is using SpecFlow & NUnit while the Java implementation is based on Cucumber JVM and JUnit.Table of Contents
=================1. Preparing your machine
2. Harry Potter Kata
3. Understanding solution
4. Licensing
5. Contacts
6. CreditsPreparing your machine
===============1.1. Java
-----------------* Download the package and unzip it. Next, import the project inside the Java folder as a Maven project inside Eclipse.
* Make sure that you are using JDK and not JRE.
* Run a build using RunAs => Maven Test
* Run tests using RunAs => JUnit Tests on the BddTestRunner.java File.
2.1. Installing Visual Studio
-----------------* Download visual studio installation from the link below and install it on your machine:
https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx
2.2. Adding Visual Studio extensions
--------------------------------* SpecFlow extension adds to visual studio the necessary BDD project templates:
Open Visual Studio and go to Tools > Extensions and Updates.
Search for SpecFlow on the online visual studio gallery and add it.* Because we will be using Nunit, it will be useful to add Nunit test adapter 3 extension to visual studio in order to run tests from within the test explorer:
Open Visual Studio and go to Tools > Extensions and Updates.
Search for NUnit test adapter on the online gallery and add it.2.3. Creating the test project
---------------------------* Finally, create a new library project and add reference to the following packages via Nuget Manager console:
Open Visual Studio and go to Tools > NuGet package manager > NuGet package manager console and type these commands.
Install-Package NUnit
Install-Package SpecFlow
Harry Potter Kata
===============You would like to buy the famous Harry Potter books but you have little money in your pocket
so you would like to write a program to help you estimate the total cost of your purchase.The rules are:
- A book costs 8 euros
- There are 5 volumes
- To get a discount, you must buy books of different volumes:
* Buying 1 book doesn't give you a discount
* Buying 2 books applies a 5% discount
* Buying 3 books applies a 10% discount
* Buying 4 books applies a 15% discount
* Buying 5 books applies a 20% discount
Examples:Given a basket
When I buy 2 books of volume 1
Then the total is 16 eurosGiven a basket
When I buy 1 book of volume 1
And I buy 1 book of volume 2
Then the total is 15.2 euros
Understanding the solution
===============- EstimatePurchaseV1: Create your first feature, generate the steps and check if the test runs ok.
- EstimatePurchaseV2: Write multiple scenarios and notice how the same steps can share their implementation. Change step scope if necessary.
- EstimatePurchaseV3: Use step sharing to reuse the existing code and reduce the amount of code parameters to write for a scenario.
- EstimatePurchaseV4: Demonstrate how tables and its helpers can be used.
- EstimatePurchaseV5: Use the scenario outline to make a more clear concept and reduce code amount.
- Note: The .Net implementation is using scopes to separate between steps where Java is using dependency injection to share the basket values.Licensing
===============HarryPotter KataBDD is licensed under a Creative Commons Attribution 3.0 Unported License.
![ScreenShot](http://i.imgur.com/4XWrp.png)
To view a copy of this license, visit [ http://creativecommons.org/licenses/by/3.0/deed.en_US ].
Contacts
===============Bilel Msekni ([email protected])
Credits
===============Thanks Pierre Gillon for the subject of this Kata: http://www.pierregillon.com/2013/10/bdd-lexemple-du-kata-potter.html