Skip to content

Instantly share code, notes, and snippets.

@aslakknutsen
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aslakknutsen/e2607f53863db10f4457 to your computer and use it in GitHub Desktop.
Save aslakknutsen/e2607f53863db10f4457 to your computer and use it in GitHub Desktop.
Cukes in Space in Standalone mode
<?xml version="1.0" encoding="UTF-8" ?>
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://jboss.org/schema/arquillian"
xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<extension qualifier="cucumber">
<property name="report">true</property>
<property name="report-directory">target/cucumber-report</property>
</extension>
<extension qualifier="webdriver">
<property name="browser">firefox</property>
</extension>
</arquillian>
package cucumber.runtime.arquillian.feature.glue;
import java.net.MalformedURLException;
import java.net.URL;
import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.openqa.selenium.WebDriver;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class CukeBellyGlue {
@Drone
protected WebDriver browser;
@When("^I eat (\\d+) cukes$")
public void eatCukes(int cukes) {
}
@Given("^I have a belly$")
public void setUpBelly() throws MalformedURLException {
browser.get("http://google.com");
}
@Then("^I should have (\\d+) cukes in my belly$")
public void shouldHaveThisMany(int cukes) {
}
}
Feature: Eat Cukes
Scenario: Eating 4 cukes
Given I have a belly
When I eat 4 cukes
Then I should have 4 cukes in my belly
Scenario: Eating 5 cukes
Given I have a belly
When I eat 5 cukes
Then I should have 5 cukes in my belly
package cucumber.runtime.arquillian.feature;
import org.jboss.arquillian.drone.api.annotation.Drone;
import org.junit.runner.RunWith;
import org.openqa.selenium.WebDriver;
import cucumber.runtime.arquillian.ArquillianCucumber;
import cucumber.runtime.arquillian.api.Features;
import cucumber.runtime.arquillian.api.Glues;
import cucumber.runtime.arquillian.feature.glue.CukeBellyGlue;
@Glues(CukeBellyGlue.class)
@Features("cucumber/runtime/arquillian/feature/cukes-in-belly.feature:3")
@RunWith(ArquillianCucumber.class)
public class CukesInBellyFunctionalTest {
// just because drone extension check test class only for injections. Without any it doesn't start the context
// will be fixed with a next version
@Drone
private WebDriver selenium;
}
<?xml version="1.0" encoding="UTF-8" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
<artifactId>cukespace-examples</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Cukes in Space! Standalone Example</name>
<properties>
<selenium.version>2.43.1</selenium.version>
<arquillian.version>1.1.5.Final</arquillian.version>
<drone.version>2.0.0.Alpha2</drone.version>
<cukes.version>1.5.10</cukes.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${arquillian.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.selenium</groupId>
<artifactId>selenium-bom</artifactId>
<version>${selenium.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-drone-bom</artifactId>
<version>${drone.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-drone-webdriver-depchain</artifactId>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-standalone</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.cukespace</groupId>
<artifactId>cukespace-core</artifactId>
<version>${cukes.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Required since Cukes default depend on -container, we need to
provide the spi without the impl -->
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-test-spi</artifactId>
</dependency>
</dependencies>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment