-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.TXT
More file actions
50 lines (37 loc) · 1.52 KB
/
README.TXT
File metadata and controls
50 lines (37 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Cuke4Duke JUnit Runner
Author: Erich Eichinger
Home: http://github.com/eeichinger/cuke4duke-junit
This project provides a JUnit integration with Cuke4Duke, the popular Cucumber framework on the Java platform. Use it to run Cucumber features by standard JUnit4 technology, which allows for much easier developing and debugging features.
Here's a snippet taken from the examples:
// HelloWorldFeature.java
@RunWith(Cuke4DukeJUnit4Runner.class)
@FeatureConfiguration("features/HelloWorld.feature")
public class HelloWorldFeature {
}
// HelloWorld.feature
Scenario: Maven/Cucumber/Java successfully interact
Given The Greeting is 'Hello'
When The Subject is 'Cucumber'
Then The Message is 'Hello, Cucumber'
// HelloWorldSteps.java
public class HelloWorldSteps {
String currentGreeting;
String currentSubject;
private final HelloWorldService helloWorldService;
public HelloWorldSteps(HelloWorldService helloWorldService) {
this.helloWorldService = helloWorldService;
}
@Given("^The Greeting is '(.*)'$")
public void setGreeting(String greeting) {
currentGreeting = greeting;
}
@When("^The Subject is '(.*)'$")
public void setSubject(String subject) {
currentSubject = subject;
}
@Then("^The Message is '(.*)'$")
public void assertMessageEquals(String expectedGreeting) {
String actualMsg = helloWorldService.getMessage(currentGreeting, currentSubject);
assertEquals(expectedGreeting, actualMsg);
}
}