serenity-bdd / serenity-cucumber

Cucumber integration for the Serenity BDD Reporting library
Other
78 stars 74 forks source link

Serenity Jbehave Driver instantiation issue across multiple pages and how to run a specific story? #67

Closed aviju2007 closed 6 years ago

aviju2007 commented 8 years ago

Hi, I have created a Maven Archetype Project for Serenity Jbehave.

I am working on automation of few Acceptance Criteria from some website page validation.

I have created definition Steps,Step library,and Page Objects with one TestRunner (extends serenity stories).I have created a login functionality separately in reusable library(page object) and using that Login method in Main Definition Steps of Acceptance criteria(customercheck.story).But Whenever I am defining page object for this acceptance criteria in SearchAndCustprofileCheck.java it is asking to provide defaulturl. But I am using driver instance of login and wants to use the same instance throughout my navigation for homepage validation without providing any further defaulturl.

PFA the my project attachment for your reference with all details and POM.xml

Can you please check once and help me for any suitable solution.

Also Please let me know how to execute a specific story as junit.This is particularly important when I wnat to selectively run story out of many stories using Jbehave -Junit.

src.zip

src.zip

POM.XML:

<?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">

4.0.0
<groupId>com.serenity.jl</groupId>
<artifactId>serenityjbehave</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Sample Serenity project using JBehave and WebDriver</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <serenity.version>1.1.36</serenity.version>
    <serenity.jbehave.version>1.13.0</serenity.jbehave.version>
    <webdriver.driver>chrome</webdriver.driver>
</properties>

<repositories>
  <repository>
    <snapshots>
    <enabled>false</enabled>
    </snapshots>
    <id>central</id>
    <name>bintray</name>
    <url>http://jcenter.bintray.com</url>
  </repository>
</repositories>
<pluginRepositories>
  <pluginRepository>
    <snapshots>
    <enabled>false</enabled>
    </snapshots>
    <id>central</id>
    <name>bintray-plugins</name>
    <url>http://jcenter.bintray.com</url>
  </pluginRepository>
</pluginRepositories>

<dependencies>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-core</artifactId>
        <version>${serenity.version}</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-jbehave</artifactId>
        <version>${serenity.jbehave.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.7</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>1.7.0</version>
    </dependency>
    <dependency>
        <groupId>com.googlecode.lambdaj</groupId>
        <artifactId>lambdaj</artifactId>
        <version>2.3.3</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.18.1</version>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.18.1</version>
            <configuration>
                <includes>
                    <include>**/*Test.java</include>
                    <include>**/*TestSuitess.java</include>
                    <include>**/Test*.java</include>
                    <include>**/When*.java</include>
                </includes>
                <argLine>-Xmx512m</argLine>
                <systemPropertyVariables>
                    <webdriver.driver>${webdriver.driver}</webdriver.driver>
                </systemPropertyVariables>
            </configuration>
            <executions>

                <execution>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                </execution> 

            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>net.serenity-bdd.maven.plugins</groupId>
            <artifactId>serenity-maven-plugin</artifactId>
            <version>${serenity.version}</version>
            <executions>
                <execution>
                    <id>serenity-reports</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Thanks in advance.

Regards, Avijit Dutta

wakaleo commented 6 years ago

If you are still having this issue, please post your question on https://serenity-bdd.rocket.chat.