cucumber java8 (#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
This commit is contained in:
parent
9c4042eb88
commit
f58c41de4d
@ -45,6 +45,12 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>info.cukes</groupId>
|
||||||
|
<artifactId>cucumber-java8</artifactId>
|
||||||
|
<version>${cucumber.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.pitest</groupId>
|
<groupId>org.pitest</groupId>
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.baeldung.testing.shopping;
|
||||||
|
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import cucumber.api.CucumberOptions;
|
||||||
|
import cucumber.api.junit.Cucumber;
|
||||||
|
|
||||||
|
@RunWith(Cucumber.class)
|
||||||
|
@CucumberOptions(features = { "classpath:features/shopping.feature" })
|
||||||
|
public class ShoppingIntegrationTest {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.baeldung.testing.shopping;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import cucumber.api.java8.En;
|
||||||
|
|
||||||
|
public class ShoppingStepsDef implements En {
|
||||||
|
|
||||||
|
private int budget = 0;
|
||||||
|
|
||||||
|
public ShoppingStepsDef() {
|
||||||
|
|
||||||
|
Given("I have (\\d+) in my wallet", (Integer money) -> budget = money);
|
||||||
|
|
||||||
|
When("I buy .* with (\\d+)", (Integer price) -> budget -= price);
|
||||||
|
|
||||||
|
Then("I should have (\\d+) in my wallet", (Integer finalBudget) -> {
|
||||||
|
assertEquals(budget, finalBudget.intValue());
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
11
testing/src/test/resources/features/shopping.feature
Normal file
11
testing/src/test/resources/features/shopping.feature
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
Feature: Shopping
|
||||||
|
|
||||||
|
Scenario: Track my budget
|
||||||
|
Given I have 100 in my wallet
|
||||||
|
When I buy milk with 10
|
||||||
|
Then I should have 90 in my wallet
|
||||||
|
|
||||||
|
Scenario: Track my budget
|
||||||
|
Given I have 200 in my wallet
|
||||||
|
When I buy rice with 20
|
||||||
|
Then I should have 180 in my wallet
|
Loading…
x
Reference in New Issue
Block a user