Skip to content

Instantly share code, notes, and snippets.

View DarylWM's full-sized avatar

Daryl Wilding-McBride DarylWM

View GitHub Profile
@DarylWM
DarylWM / ricky.sbt
Last active December 29, 2015 16:49
name := "sample-with-cucumber"
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache
"info.cukes" % "cucumber-java" % "1.1.5" % "test",
"info.cukes" % "cucumber-junit" % "1.1.5" % "test"
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"
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@Cucumber.Options(format = {"pretty"})
public class RunCucumber {
}
$ play test
...
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$")
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;
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 {
}
...
0m[error] Test Scenario: Cucumber Integration failed: expected:<'[Cucumber]'> but was:<'[Welcome to Play]'>
...
@(message: String)
@main("Cucumber") {
@play20.welcome(message, style = "Java")
}