Skip to content

Instantly share code, notes, and snippets.

View DarylWM's full-sized avatar

Daryl Wilding-McBride DarylWM

View GitHub Profile
1 Scenarios (1 passed)
3 Steps (3 passed)
0m3.544s
@(message: String)
@main("Cucumber") {
@play20.welcome(message, style = "Java")
}
...
0m[error] Test Scenario: Cucumber Integration failed: expected:<'[Cucumber]'> but was:<'[Welcome to Play]'>
...
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import static org.fest.assertions.Assertions.assertThat;
public class Steps {
@Given("^I have setup Play$")
public void I_have_setup_Play() throws Throwable {
}
import cucumber.api.java.Before;
import play.test.TestBrowser;
import play.test.TestServer;
import static play.test.Helpers.*;
public class GlobalHooks {
public static int PORT = 3333;
public static TestBrowser TEST_BROWSER;
private static TestServer TEST_SERVER;
private static boolean initialised = false;
import cucumber.api.java.Before;
import play.test.TestBrowser;
import play.test.TestServer;
import static play.test.Helpers.*;
public class GlobalHooks {
public static int PORT = 3333;
public static TestBrowser TEST_BROWSER;
private static TestServer TEST_SERVER;
private static boolean initialised = false;
...
You can implement missing steps with the snippets below:
@Given("^I have setup Play$")
public void I_have_setup_Play() throws Throwable {
// Express the Regexp above with the code you wish you had
throw new PendingException();
}
@When("^I go to the landing page$")
$ play test
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@Cucumber.Options(format = {"pretty"})
public class RunCucumber {
}
Feature: Testing Cucumber Integration
Scenario: Cucumber Integration
Given I have setup Play
When I go to the landing page
Then the title should be "Cucumber"