serenity-bdd / serenity-demos

64 stars 170 forks source link

Issues while trying to create Serenity Cucumber API testing framework --help #56

Open anjalisi4883 opened 3 years ago

anjalisi4883 commented 3 years ago

Hi @wakaleo ,

I'm trying to create Serenity cucumber API testing framework but facing below issues with it related to serenity versions . Could you please have a look at my issues and guide me how to proceed ahead . It would be great help , I'm stuck with this from last few days. Thanks.

  1. I tried creating framework by cloning from https://github.com/serenity-bdd/serenity-rest-starter And I kept all the dependencies versions as it was. setup was done but it was throwing error as "step definitions are missing for the feature file" Then I tried updating versions and got below issues.

  2. Then secondly I tried making changes with latest versions in pom.xml file but getting error as below- Could not resolve dependencies for project net.serenitybdd.api:serenity-cucumber-api-testing:jar:1.0.0-SNAPSHOT: Failure to find net.serenity-bdd:serenity-cucumber5:jar:1.9.45 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced ->

Also , I tried with deleting .m2 folder many times and tried adding serenity-cucmber-api-testing jar manually to .m2 folder but nothing worked. Getting error on cucumbertestSuite file as -CucumberOptions cannot be resolved. import io.cucumber.junit.*; import net.serenitybdd.junit.runners.SerenityRunner; import org.junit.runner.RunWith; @RunWith(SerenityRunner.class) @CucumberOptions(

here is my Pom.xml file.

<?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>net.serenitybdd.api</groupId>
<artifactId>serenity-cucumber-api-testing</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Serenity BDD project using Cucumber for API testing</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <serenity.version>2.3.9</serenity.version>
    <serenity.cucumber.version>1.9.45</serenity.cucumber.version>
    <serenity.maven.version>2.0.49</serenity.maven.version>
    <cucumber.version>6.9.1</cucumber.version>
    <logback.version>1.2.3</logback.version>
    <encoding>UTF-8</encoding>
    <tags></tags>
    <parallel.tests>4</parallel.tests>
    <webdriver.base.url></webdriver.base.url>
</properties>

<dependencies>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>${logback.version}</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-core</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>io.cucumber</groupId>
                <artifactId>cucumber-core</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>${cucumber.version}</version>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>${cucumber.version}</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-junit</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-rest-assured</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-cucumber5</artifactId>
        <version>${serenity.cucumber.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>3.6.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>1.3</version>
        <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.skyscreamer/jsonassert -->
    <dependency>
        <groupId>org.skyscreamer</groupId>
        <artifactId>jsonassert</artifactId>
        <version>1.5.0</version>
        <scope>test</scope>
    </dependency>

</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.1</version>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.22.1</version>
            <configuration>
                <includes>
                    <include>**/*functionaltestcases.java</include>
                    <include>**/Test*.java</include>
                    <include>**/*TestSuite.java</include>
                    <include>**/When*.java</include>
                </includes>
                <systemPropertyVariables>
                    <webdriver.base.url>${webdriver.base.url}</webdriver.base.url>
                </systemPropertyVariables>
                <parallel>classes</parallel>
                <threadCount>${parallel.tests}</threadCount>
                <forkCount>${parallel.tests}</forkCount>
            </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.8.0</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>net.serenity-bdd.maven.plugins</groupId>
            <artifactId>serenity-maven-plugin</artifactId>
            <version>${serenity.maven.version}</version>
            <configuration>
              <tags>${tags}</tags>
            </configuration>
            <executions>
                <execution>
                    <id>serenity-reports</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>