[JVM] getting mvn working with 1.1.2

瀏覽次數:1,064 次
跳到第一則未讀訊息

BillR

未讀,
2013年2月19日 下午3:19:012013/2/19
收件者:cu...@googlegroups.com
I'm trying to get maven working with 1.1.2 in order to put together a github pull request illustration of a bug that a colleague who is on vacation reported in the context of our gradle setup. So I'm trying to get old-version maven code working with the latest cuke jvm.

Here is the error (seems to be same dir being searched twice):

Tests in error:
  initializationError(com.xoom.qa.cuke.steps.RunCukesTest): Duplicate step definitions in com.xoom.qa.cuke.steps.RegularSteps.doomedGiven() in file:/home/xoom/cuke_bug/target/test-classes/ and com.xoom.qa.cuke.steps.RegularSteps.doomedGiven() in file:/home/xoom/cuke_bug/target/test-classes/

All the classes in that tree:

~/cuke_bug> find /home/xoom/cuke_bug/target/test-classes/ -name "*.class"
/home/xoom/cuke_bug/target/test-classes/com/xoom/qa/cuke/steps/RegularSteps.class
/home/xoom/cuke_bug/target/test-classes/com/xoom/qa/cuke/steps/BeforeAfterSteps.class
/home/xoom/cuke_bug/target/test-classes/com/xoom/qa/cuke/steps/RunCukesTest.class

Here is the surefire setup:

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${surefire.version}</version>
                    <configuration>
                        <argLine>-Xmx2048m</argLine>
                        <systemProperties>
                            <property>
                                <!-- When Cucumber-JVM supports replace/append of cucumber.options, this can be removed, along with the
                                <tags> property above.  msp 6/14/2012 -->
                                <name>cucumber.options</name>
                                <value>--tags ${tags} --format pretty --monochrome --glue classpath:com/xoom/qa/cuke/steps</value>
                            </property>
                        </systemProperties>

                    </configuration>
                 ...

Here is the one java file that exists with the Given method:

package com.xoom.qa.cuke.steps;

import cucumber.api.java.en.Given;
import static org.junit.Assert.*;

public class RegularSteps {

    @Given("^a step that fails$")
    public void doomedGiven() {
        throw new RuntimeException("Step fails..");
    }
}

And here is the junit file:

package com.xoom.qa.cuke.steps;

import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
//@Cucumber.Options(format="pretty", monochrome = true)
public class RunCukesTest {
}

I'm not seeing why cuke is finding the same file twice.

Thanks,
Bill

BillR

未讀,
2013年2月19日 下午6:25:262013/2/19
收件者:cu...@googlegroups.com

When I take the --glue classpath: arg out of my surefire setup, I get:

Tests in error:
  com.xoom.qa.cuke.steps.RunCukesTest: org.junit.runner.Description.createSuiteDescription(Ljava/lang/String;Ljava/io/Serializable;[Ljava/lang/annotation/Annotation;)Lorg/junit/runner/Description;

java.lang.NoSuchMethodError: org.junit.runner.Description.createSuiteDescription(Ljava/lang/String;Ljava/io/Serializable;[Ljava/lang/annotation/Annotation;)Lorg/junit/runner/Description;
        at cucumber.runtime.junit.FeatureRunner.getDescription(FeatureRunner.java:43)
        at cucumber.api.junit.Cucumber.describeChild(Cucumber.java:72)
        at cucumber.api.junit.Cucumber.describeChild(Cucumber.java:37)
        at org.junit.runners.ParentRunner.getDescription(ParentRunner.java:290)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:296)
        at cucumber.api.junit.Cucumber.run(Cucumber.java:82)

Not sure if that's a step forward or back.
 

Thanks,
Bill

BillR

未讀,
2013年2月20日 下午1:19:112013/2/20
收件者:cu...@googlegroups.com
Solved - I needed JUnit 4.11 to get the needed method. Thanks to a local colleague for figuring it out.

Bill

BillR

未讀,
2013年2月20日 下午2:00:422013/2/20
收件者:cu...@googlegroups.com


On Wednesday, February 20, 2013 10:19:11 AM UTC-8, BillR wrote:
Solved - I needed JUnit 4.11 to get the needed method. Thanks to a local colleague for figuring it out.

Oops, sorry for the top-post above.
A nice feature would be if cucumber-jvm could check which JUnit version is loaded and complain explicitly if wrong.

Bill

回覆所有人
回覆作者
轉寄
0 則新訊息