Updated README

This commit is contained in:
Dipanjan Bhowmik 2021-10-11 11:12:27 +05:30
parent 11a5938e49
commit 9bb570b0c3

View File

@ -1,39 +1,7 @@
Added cucumber for running the tests and
added the lines written in the specification as is in this.
### How to do the BDD
The cucumber feature file example is somewhat like:
1. Write a test scenario in Feature file: **src/test/resources/GildedRose.feature**
2. Modify the StepDefinitions file to match the Feature description in: **src/test/java/com/gildedrose/StepDefinitions.java**
3. Run: **./gradlew cucumber** from project dir
**src/test/resources/GildedRose.feature**
```gherkin
Feature: Gilded Rose quality
I want to know if the quality is updated properly
Scenario: Sellin and Quality decreasing
Given for "+5 Dexterity Vest" initial sellin is 20 and quality is 30
When I update the quality
Then I should get sellin as 19 and quality as 29
...
```
And the result is shown as:
```
$ ./gradlew cucumber
> Task :cucumber
Scenario: Sellin and Quality decreasing # src/test/resources/GildedRose.feature:4
Given for "+5 Dexterity Vest" initial sellin is 20 and quality is 30 # com.gildedrose.StepDefinitions.initial_sellin_is_and_quality_is(java.lang.String,int,int)
When I update the quality # com.gildedrose.StepDefinitions.i_update_the_quality()
Then I should get sellin as 19 and quality as 29 # com.gildedrose.StepDefinitions.i_should_get_sellin_as_and_quality_as(int,int)
1 Scenarios (1 passed)
3 Steps (3 passed)
0m0.376s
BUILD SUCCESSFUL in 2s
```
Note: If you want to decrease update the quality twice, just repeat the line "When I update the quality" twice in the feature file.
Note: Please check https://cucumber.io for syntax references.