serenity-bdd / serenity-core

Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.
http://serenity-bdd.info
Other
723 stars 518 forks source link

Tests run but "Generating test results for 0 tests" #1320

Closed dev0101 closed 6 years ago

dev0101 commented 6 years ago

Hello,

I use Serenity BDD + cucumber, sometimes the reports aren't generated. It depends on tags i used : --tags ~@test : no reports without tags : no reports --tags @critique : i have reports

i use this versions :

1.9.31 1.9.31 1.9.12 When i have no reports i have this in the console : [ERROR] Tests run: 79, Failures: 4, Errors: 14, Skipped: 0 ... [INFO] Generating test results for 0 tests [INFO] 41 requirements loaded after 439 ms [INFO] 41 related requirements found after 439 ms [INFO] Generating test outcome reports: false [INFO] Starting generating reports: 554 ms [INFO] Configured report threads: 20 [INFO] Test results for 0 tests generated in 2773 ms
wakaleo commented 6 years ago

You need to use the new Cucumber tag syntax (https://github.com/cucumber/cucumber/tree/master/tag-expressions). (see https://github.com/serenity-bdd/serenity-cucumber/issues/129)

dev0101 commented 6 years ago

Even without tags i have this issue

The following command execute tests but doesn't generate reports : mvn clean verify

wakaleo commented 6 years ago

What does your test runner look like?

dev0101 commented 6 years ago

package com.tests.automatedtests.runners;

import org.junit.runner.RunWith; import net.serenitybdd.cucumber.CucumberWithSerenity; import cucumber.api.CucumberOptions;

@RunWith(CucumberWithSerenity.class) @CucumberOptions(features= {"src/test/resources/features"}, glue="com.tests.automatedtests.glue") public class GlobalRunner { }

wakaleo commented 6 years ago

Are you setting the tags property anywhere in the pom.xml or serenity.properties?

dev0101 commented 6 years ago

no

wakaleo commented 6 years ago

Try comparing your project with https://github.com/serenity-bdd/serenity-cucumber-starter.

dev0101 commented 6 years ago

the differences are :

I gonna try to use this version

dev0101 commented 6 years ago

I have the same issue using the versions : the Serenity version : 1.9.26 the Serenity Cucumber version :1.9.8 the maven-failsafe-plugin and maven-surefire-plugin : 2.20

wakaleo commented 6 years ago

I don't think it's related to the versions (this is a common use case), rather something to do with your feature files or project structure. I would need to look at the project directly. You can ask for help from the Serenity community on https://serenity-bdd.rocket.chat or get some professional help with one of the Serenity Support packages (https://johnfergusonsmart.com/serenity-bdd-mentoring#support)

dev0101 commented 6 years ago

ok, thank you for your help

PrasadNutalapati commented 5 years ago

BTW, I am facing the same issue. Here is my pom.

<?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>com.transunion.qa.serenityjvm.datahubui</groupId>
  <artifactId>com.transunion.qa.serenity.datahubui</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>TransUnion Analytics Engineering DataHub UI Test Automation using Serenity project using Cucumber and WebDriver</name>

      <properties>
        <serenity.version>2.0.24</serenity.version>
        <serenity.maven.version>2.0.24</serenity.maven.version>
        <serenity.cucumber.version>1.9.21</serenity.cucumber.version>
        <serenity.report.resources.version>2.0.24</serenity.report.resources.version>
        <serenity.cucumber.archetype.version>1.8.4</serenity.cucumber.archetype.version>
        <serenity.junit.archetype.version>1.8.4</serenity.junit.archetype.version>
        <ngwebdriver.version>1.1.4</ngwebdriver.version>
        <assertj.version>3.5.1</assertj.version>
        <parallel.tests>1</parallel.tests>
        <webdriver.driver>chrome</webdriver.driver>
        <encoding>UTF-8</encoding>
    </properties>

    <dependencies>
    <dependency>
            <groupId>com.paulhammant</groupId>
            <artifactId>ngwebdriver</artifactId>
            <version>${ngwebdriver.version}</version>
            <!-- You might want to delete the following line if you get "package com.paulhammant.ngwebdriver does not exist" errors -->
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-core</artifactId>
            <version>[${serenity.version}]</version>
        </dependency>
         <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
                <scope>provided</scope>                
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-junit</artifactId>
            <version>[${serenity.version}]</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-cucumber</artifactId>
            <version>[${serenity.cucumber.version}]</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-report-resources</artifactId>
            <version>[${serenity.report.resources.version}]</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-cucumber-archetype</artifactId>
            <version>[${serenity.cucumber.archetype.version}]</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-junit-archetype</artifactId>
            <version>[${serenity.junit.archetype.version}]</version>
        </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>**/TestRunner.java</include>
                    </includes>
                    <systemProperties>
                        <webdriver.driver>${webdriver.driver}</webdriver.driver>
                    </systemProperties>
                    <parallel>classes</parallel>
                    <threadCount>${parallel.tests}</threadCount>
                    <forkCount>${parallel.tests}</forkCount>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </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>[${serenity.version}]</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>serenity-reports</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>aggregate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

Here is my project structure.

|____j-pageobjects-serenity-cucumber.iml
|____pom.xml
|____chromedriver.exe
|____pom_ORIG.xml
|____.settings
| |____org.eclipse.jdt.core.prefs
| |____org.eclipse.m2e.core.prefs
| |____org.eclipse.core.resources.prefs
|____chromedriver
|____.idea
| |____encodings.xml
| |____uiDesigner.xml
| |____workspace.xml
| |____misc.xml
| |____compiler.xml
|____src
| |____.DS_Store
| |____test
| | |____.DS_Store
| | |____resources
| | | |____datahub
| | | | |____narrative.txt
| | | | |____ExtractExecutionHistory.feature
| | |____java
| | | |____steps
| | | | |____PramaDatahubPageStep.java
| | | |____ExtractExecutionHistoryRunner.java
| | | |____stepdefinitions
| | | | |____ExtractExecutionHistoryStepDefinitions_copy.java
| | | | |____ExtractExecutionHistoryStepDefinitions.java
| |____main
| | |____.DS_Store
| | |____resources
| | |____java
| | | |____.DS_Store
| | | |____pageobjects
| | | | |____DataHubPage.java

Here is my Runner file.

import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.SnippetType;
import net.serenitybdd.cucumber.CucumberWithSerenity;

@RunWith(CucumberWithSerenity.class)
@CucumberOptions(
        features = "src/test/resources/datahub/ExtractExecutionHistory.feature",
        dryRun = false,
        strict = false,
        glue = "src/test/java/stepdefinitions/",
        //tags = { "~@wip","~@notImplemented","@sanity" },
        plugin = {"pretty", "html:target/cucumber-html-report"}, //pretty, progress, rerun, usage
       //   plugin = { "pretty" }, //pretty, progress, rerun, usage
        snippets = SnippetType.CAMELCASE    // CAMELCASE,UNDERSCORE 
        )
public class TestExtractExecutionHistoryRunner {

//  public static void main(String[] args){}
}
PrasadNutalapati commented 5 years ago

Solved by Wakaleo's suggestion(else where) to comparing pom.xml from https://github.com/serenity-bdd/screenplay-pattern-todomvc

handresc1127 commented 5 years ago

I had the same problem, solved it using "cucumber.options" instead of "tags". Examples:

Ok - Generating test results for n tests mvn -Dcucumber.options="--tags ''" clean install mvn -Dcucumber.options="--tags '@Tag1'" clean install mvn -Dcucumber.options="--tags @Tag1" clean install

Error Generating test results for 0 tests mvn -Dtags=@Tag1 clean install

brcros commented 2 years ago

Solved by Wakaleo's suggestion(else where) to comparing pom.xml from https://github.com/serenity-bdd/screenplay-pattern-todomvc

It would be great to have the missing detail... i experienced the same error using serenity-rest pom and cannot really compare pom.xml. thank you.