question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

After adding courgette-jvm and runner in Junit project , getting Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

See original GitHub issue

Hi @prashant-ramcharan,

I have integrated courgette-jvm with my old project and trying to run the maven command.

It is running good but after running the test cases maven does not recognising how many test cases it ran, fail, pass.

I have attached the screenshot of the maven log & pom.xml.

image

  • [ ]

  • [ ]

`<?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.testCompay</groupId>
<artifactId>project1</artifactId>
<name>TestProject</name>
<version>1.0-SNAPSHOT</version>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>11</java.version>
    <selenium.version>3.141.59</selenium.version>
    <junit.version>4.13.2</junit.version>
    <cucumber.version>6.10.3</cucumber.version>
    <chrome.webdriver.manager.version>4.4.3</chrome.webdriver.manager.version>
    <maven.compiler.version>3.8.1</maven.compiler.version>
    <maven.surefire.version>3.0.0-M5</maven.surefire.version>
    <maven.failsafe.version>3.0.0-M1</maven.failsafe.version>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>${selenium.version}</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>${cucumber.version}</version>
    </dependency>

    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.7</version>
    </dependency>

    <dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>${chrome.webdriver.manager.version}</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-picocontainer</artifactId>
        <version>${cucumber.version}</version>
        <!--            <scope>test</scope>-->
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.6.4</version>
    </dependency>

    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-core</artifactId>
        <version>1.3.0-alpha5</version>
    </dependency>

    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.3.0-alpha5</version>
        <!--            <scope>test</scope>-->
    </dependency>


    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>${cucumber.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>net.masterthought</groupId>
        <artifactId>cucumber-reporting</artifactId>
        <version>3.8.0</version>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20210307</version>
    </dependency>

    <dependency>
        <groupId>io.github.prashant-ramcharan</groupId>
        <artifactId>courgette-jvm</artifactId>
        <version>5.11.0</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>5.0.0</version>
    </dependency>

    <dependency>
        <groupId>com.opencsv</groupId>
        <artifactId>opencsv</artifactId>
        <version>5.5.1</version>
    </dependency>


</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compiler.version}</version>
            <configuration>
                <encoding>UTF-8</encoding>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven.surefire.version}</version>
            <configuration>
                <!-- Activate the use of TCP to transmit events to the plugin -->
                <forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
            </configuration>
        </plugin>
        <plugin>
            <groupId>net.masterthought</groupId>
            <artifactId>maven-cucumber-reporting</artifactId>
            <version>5.0.0</version>
            <executions>
                <execution>
                    <id>execution</id>
                    <!-- <phase>verify</phase> -->
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <projectName>Test Project</projectName>
                        <inputDirectory>${project.build.directory}/target/cucumber-reports</inputDirectory>
                        <outputDirectory>${project.build.directory}/cucumber-report-html</outputDirectory>
                        <jsonFiles>
                            <!-- supports wildcard or name pattern -->
                            <param>**/cucumber.json</param>
                        </jsonFiles>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

</project>`

Please correct me if I have done any wrong thing.

Thanks, Aravind

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
prashant-ramcharancommented, Nov 8, 2021

Hi @aravindkesavarapu

This is as expected. Maven counts the number of feature files so in the below scenario:

feature1.feature (has 1 scenario)
feature2.feature (has 2 scenarios)
feature3.feature (has 3 scenarios)
  • Maven will always count it as 3 tests
  • Courgette (CourgetteRunLevel.FEATURE) will count it as 3 tests
  • Courgette (CourgetteRunLevel.SCENARIO) will count it as 6 tests

With regards to the test failure stacktrace, this will be available in the Cucumber and Courgette reports. If Maven were to fail then it’s stacktrace will be shown in the console and not the actual test failure stacktrace.

0reactions
prashant-ramcharancommented, Dec 5, 2021

Hi @aravindkesavarapu

This is how Courgette is intended to work.

In the example above, you running using CourgetteRunLevel.SCENARIO which means Courgette extracts each scenario from the feature file and runs it separately. The end result is you will have each scenario reported separately in the cucumber reports.

Use CourgetteRunLevel.FEATURE if you need the Cucumber reports to show as one feature result instead of separate scenarios results.

This is the feature file with 3 examples - Courgette will run each example separately (in parallel) if using CourgetteRunLevel.SCENARIO

Screenshot 2021-12-05 at 11 36 58

This shows as 3 separate runs / results in the Cucumber reports.

Notice the green tick next to each scenario example. This directly corresponds to the data in cucumber.json

Screenshot 2021-12-05 at 11 36 44
Read more comments on GitHub >

github_iconTop Results From Across the Web

no "Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, " even that ...
When I had this problem in my Selenium project I realized that I was using junit and TestNG as well. I removed TestNG...
Read more >
Why Your JUnit 5 Tests Are Not Running Under Maven
There is a very common issue preventing your JUnit 5 tests from running under Maven. In this post, I explain why and provide...
Read more >
Testing in Maven | IntelliJ IDEA Documentation - JetBrains
In the Maven project, you can create and run tests the same way you do in any other project using the default IntelliJ...
Read more >
Determine the Execution Time of JUnit Tests - Baeldung
There are a few ways to view our test execution reports. ... [INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time...
Read more >
Class MavenSurefireJUnit48RunnerTest - Apache Maven
public class MavenSurefireJUnit48RunnerTest extends junit.framework. ... <p/> Results : <p/> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 <p/> [INFO] ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found