Failed scenario is duplicated by a Scenario.classMethod in JUnit report

327 views
Skip to first unread message

Aleksei Valikov

unread,
Jun 17, 2016, 8:38:42 AM6/17/16
to Cukes
Hi,

we have a problem that when Cucumber scenario fails, we see duplicate error in the JUnit report in Jenkins.

Here's a sample scenario(no matter what it does, just for reference):

Feature: Step definitions for timetable
  Scenario: Create minimalistic timetable with overnights
    Given Timetable
      | station | arrival | departure |
      | MH      |         | 06:03     |
      | MIH     |         | 05:03     |
      | FF      |         | 04:03     |
      | EDO     | 03:00   |           |
    Then Timetable equals
      | station | arrivalDate | arrival | departureDate | departure |
      | MH      |             |         | 2015-08-25    | 06:03     |
      | MIH     | 2015-08-26  | 05:00   | 2015-08-26    | 05:03     |
      | FF      | 2015-08-27  | 04:00   | 2015-08-27    | 04:03     |
      | EDO     | 2015-08-28  | 03:01   |               |           |

This scenario fails as arrival time in EDO is 03:00, not 03:01.

We execute tests via JUnit:

@RunWith(Cucumber.class)
@ContextConfiguration(classes = CucumberConfiguration.class)
public class RunCucumberTest {

}

When tests are run via Gradle build on the CI server (Jenkins), we get this failing scenario reported twice. Once as "Scenario: Step definitions for timetable.Then Timetable equals" and once as "Scenario: Step definitions for timetable.classMethod". This is how it looks like in Jenkins:



And here's the generated JUnit report:

<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="Scenario: Create minimalistic timetable with overnights" tests="3" skipped="0" failures="2" errors="0" timestamp="2016-06-16T11:40:51" hostname="ip-10-43-151-79" time="0.14">
  <properties/>
  <testcase name="Given Timetable" classname="Scenario: Create minimalistic timetable with overnights" time="0.0"/>
  <testcase name="Then Timetable equals" classname="Scenario: Create minimalistic timetable with overnights" time="0.009">
    <failure message="org.junit.ComparisonFailure: ..." type="org.junit.ComparisonFailure">...</failure>
  </testcase>
  <testcase name="classMethod" classname="Scenario: Create minimalistic timetable with overnights" time="0.157">
    <failure message="org.junit.ComparisonFailure: ..." type="org.junit.ComparisonFailure">...</failure>
  </testcase>
  <system-out>...</system-out>
  <system-err><![CDATA[...]]></system-err>
</testsuite>

As you see, classMethod is present here as a test case.

We'd like to get rid of the second "classMethod" report. Does anyone have an idea how to do this?

Best wishes,
Alexey




Rye L

unread,
Jul 24, 2016, 5:26:00 PM7/24/16
to Cukes
Same issue here. Did you figure it out Alexey?

che...@smart-trade.net

unread,
May 16, 2017, 10:51:24 AM5/16/17
to Cukes
I don't know if you still need help, but adding "junit:target/cucumber.xml" in @CucumberOptions solved this problem for me

Renato Ćurić

unread,
Jan 23, 2018, 1:55:14 PM1/23/18
to Cukes
Hi Aleksei, 

Did you manage to solve the issue? I have the same problem.

Best regards,
Renato

Yang Zhao

unread,
Feb 2, 2018, 3:54:56 AM2/2/18
to Cukes
Did you solve this problem? I have the same issue.
Reply all
Reply to author
Forward
0 new messages