Skip to content

Commit f58c41d

Browse files
Doha2012pivovarit
authored andcommitted
cucumber java8 (eugenp#2306)
* minor logging fix * spring security sso * use basic auth * use form login * cleanup * cleanup * final cleanup * second client app for sso * spring boot bootstrap * add logic * cleanup * add simple controller * add thymeleaf and security * minor fix * minor fix * add more boot properties * fix live test * fix live test * minor fix * semaphores * fix configuration * kotlin collection * add more collection examples * minor upgrade * cucumber java8
1 parent 9c4042e commit f58c41d

4 files changed

Lines changed: 51 additions & 0 deletions

File tree

‎testing/pom.xml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@
4545
<scope>test</scope>
4646
</dependency>
4747

48+
<dependency>
49+
<groupId>info.cukes</groupId>
50+
<artifactId>cucumber-java8</artifactId>
51+
<version>${cucumber.version}</version>
52+
<scope>test</scope>
53+
</dependency>
4854

4955
<dependency>
5056
<groupId>org.pitest</groupId>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.baeldung.testing.shopping;
2+
3+
import org.junit.runner.RunWith;
4+
5+
import cucumber.api.CucumberOptions;
6+
import cucumber.api.junit.Cucumber;
7+
8+
@RunWith(Cucumber.class)
9+
@CucumberOptions(features = { "classpath:features/shopping.feature" })
10+
public class ShoppingIntegrationTest {
11+
12+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.baeldung.testing.shopping;
2+
3+
import static org.junit.Assert.assertEquals;
4+
import cucumber.api.java8.En;
5+
6+
public class ShoppingStepsDef implements En {
7+
8+
private int budget = 0;
9+
10+
public ShoppingStepsDef() {
11+
12+
Given("I have (\\d+) in my wallet", (Integer money) -> budget = money);
13+
14+
When("I buy .* with (\\d+)", (Integer price) -> budget -= price);
15+
16+
Then("I should have (\\d+) in my wallet", (Integer finalBudget) -> {
17+
assertEquals(budget, finalBudget.intValue());
18+
});
19+
20+
}
21+
22+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Feature: Shopping
2+
3+
Scenario: Track my budget
4+
Given I have 100 in my wallet
5+
When I buy milk with 10
6+
Then I should have 90 in my wallet
7+
8+
Scenario: Track my budget
9+
Given I have 200 in my wallet
10+
When I buy rice with 20
11+
Then I should have 180 in my wallet

0 commit comments

Comments
 (0)