0

`I am learning Cucumber. I am following the 10 minutes tutorial.

According with the tutorial, I should see: Failed scenarios:

hellocucumber/is_it_friday_yet.feature:4 # Sunday isn't Friday
1 Scenarios (1 failed)3 Steps (1 failed, 2 passed)

But I am seeing:

[ERROR] Failures:[ERROR]   expected: <Nope> but was: <null>[INFO][ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

I cant see how many Scenarios and steps I have and how many passed and failed.

I have this pom:

`<?xml version="1.0" encoding="UTF-8"?><project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>hellocucumber</groupId>
<artifactId>hellocucumber</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-bom</artifactId>
            <version>7.18.0</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.junit</groupId>
            <artifactId>junit-bom</artifactId>
            <version>5.10.2</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit-platform-engine</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-suite</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.13.0</version>
            <configuration>
                <encoding>UTF-8</encoding>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.2.5</version>
        </plugin>
    </plugins>
</build>
</project>

This is is_it_friday_yet.feature:

`Feature: Is it Friday yet?Everybody wants to know when it's Friday
Scenario: Sunday isn't FridayGiven today is SundayWhen I ask whether it's Friday yetThen I should be told "Nope"`

This is Stepdefs.java:

package hellocucumber;
import io.cucumber.java.en.*;
import static org.junit.jupiter.api.Assertions.assertEquals;

class IsItFriday {static String isItFriday(String today) 
{return null;}
}

public class Stepdefs {private String today;private String actualAnswer;
@Given("today is Sunday")
public void today_is_Sunday() {
    today = "Sunday";
}

@When("I ask whether it's Friday yet")
public void i_ask_whether_it_s_Friday_yet() {
    actualAnswer = IsItFriday.isItFriday(today);
}

@Then("I should be told {string}")
public void i_should_be_told(String expectedAnswer) {
    assertEquals(expectedAnswer, actualAnswer);
}
}

And this is the RunCucumberTest.java:

@Suite @IncludeEngines("cucumber") 
@SelectPackages("hellocucumber") 
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty") 

public class RunCucumberTest { 
}

When I run mvn test I cant see how many Scenarios and steps I have and how many passed and failed.

1 Answer 1

1

I got the answer from the people from Cucumber. It is necessary to add the summary plugin to print the summary of executed steps and scenarios. In the RunCucumberTest.java should be: @ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty, summary")

Not the answer you're looking for? Browse other questions tagged or ask your own question.