<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>my-project-tests</groupId> <artifactId>my-project-tests</artifactId> <version>0.0.1-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <serenity.version>2.0.30</serenity.version> <serenity.maven.version>2.0.30</serenity.maven.version> <webdriver.driver>chrome</webdriver.driver> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.6</version> <executions> <execution> <goals> <goal>test-jar</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <compilerId>groovy-eclipse-compiler</compilerId> <compilerVersion>1.8</compilerVersion> <source>1.8</source> <target>1.8</target> <verbose>false</verbose> </configuration> <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-compiler</artifactId> <version>2.9.2-01</version> </dependency> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-batch</artifactId> <version>2.4.3-01</version> </dependency> </dependencies> </plugin> <plugin> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-compiler</artifactId> <version>2.9.2-01</version> <extensions>true</extensions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version> <configuration> <testFailureIgnore>true</testFailureIgnore> </configuration> </plugin> <plugin> <artifactId>maven-failsafe-plugin</artifactId> <version>2.18</version> <configuration> <includes> <include>**/features/*.feature</include> </includes> <systemProperties> <webdriver.driver>${webdriver.driver}</webdriver.driver> </systemProperties> </configuration> </plugin> <plugin> <groupId>net.serenity-bdd.maven.plugins</groupId> <artifactId>serenity-maven-plugin</artifactId> <version>${serenity.maven.version}</version> <dependencies> <dependency> <groupId>net.serenity-bdd</groupId> <artifactId>serenity-core</artifactId> <version>2.0.30</version> </dependency> </dependencies> <executions> <execution> <id>serenity-reports</id> <phase>post-integration-test</phase> <goals> <goal>aggregate</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>net.serenity-bdd</groupId> <artifactId>serenity-core</artifactId> <version>${serenity.version}</version> </dependency> <dependency> <groupId>net.serenity-bdd</groupId> <artifactId>serenity-junit</artifactId> <version>${serenity.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.25</version> </dependency> <dependency> <groupId>net.serenity-bdd</groupId> <artifactId>serenity-cucumber</artifactId> <version>1.9.23</version> </dependency> <dependency> <groupId>net.serenity-bdd</groupId> <artifactId>serenity-rest-assured</artifactId> <version>${serenity.version}</version> </dependency> <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path-assert</artifactId> <version>2.2.0</version> <scope>test</scope> </dependency> <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-all</artifactId> <version>1.3</version> <scope>test</scope> </dependency> </dependencies></project>package com.qa.features
import cucumber.api.CucumberOptions;import net.serenitybdd.cucumber.CucumberWithSerenity;import org.junit.runner.RunWith;
@RunWith(CucumberWithSerenity.class)@CucumberOptions(features="src/test/resources/features")class TestRunner {
}mvn clean verifyNo need to provide us here with code under NDA. Just create an MCVE reproducing your problem, something I can build and run and then verify by myself if it does what you want or not. I think you cannot expect anyone to dream up their own sample project for that. I have never used your specific tool combination, so I would appreciate something to start with. I personally use Spock + Geb + Maven, but have never used Cucumber (because Spock already is a BDD tool) and have never heard of Serenity before.
--
Alexander Kriegisch
https://scrum-master.de
--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/01d0b639-23ed-43ba-9056-51ef3b9f1630%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/20190329025932.E233E44C06A5%40dd39516.kasserver.com.
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.13</version>
</dependency>
<dependency>
<groupId>org.gebish</groupId>
<artifactId>geb-core</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.14.0</version>
</dependency>import geb.Browser
import geb.binding.BindingUpdater
import org.openqa.selenium.WebElement
import cucumber.api.java.After
import cucumber.api.java.Before
class UiSteps {
def bindingUpdater
def browser
@Before
public void initiateAdapter(){
browser = new Browser()
bindingUpdater = new BindingUpdater(new Binding(), browser)
bindingUpdater.initialize()
}
@After
public void removeAdapter(){
bindingUpdater.remove()
}
}
import geb.Browser
import com.myproject.pages.JobsPage
@When("^.* navigate? to a job by (index|name|id) (.*)")
public void user_opens_a_job(findJobBy, identifier){
Browser.drive{
at JobsPage
switch(findJobBy){
case "index":
openJobByIndex(Integer.parseInt(identifier)) //openJobByIndex is a method in JobsPage class
break
case "id":
openJobById(identifier) //openJobById is a method in JobsPage class
break
default:
break
}
}
}