JVM - passing a tag does not work

151 views
Skip to first unread message

Javix

unread,
Jul 23, 2012, 10:40:23 AM7/23/12
to cu...@googlegroups.com
I tried to tag a feature like that:
@hello
Feature: Hello World

 
Scenario: Say hello
   
Given I have a hello app with "Howdy"
   
When I ask it to say hi
   
Then it should answer with "Howdy World"

it is just a modified feature took from the examples folder of cucumber-jvm distribution. Then I ran it as explained:
mvn clean test -DtagArg="@hello"

Nevertheless all the features were run. What did I wrong?
OS: Windows XP Pro SP3, Ruby 1.9.3; Cucumber version: (1.2.1)
Thank you.

Rex Hoffman

unread,
Jul 25, 2012, 4:18:46 PM7/25/12
to cu...@googlegroups.com
You need to pass the parameter in to your test execution jvm run.

Your tests are probably run in a forked jvm just so they don't include these system parameters.

If you're using the cucumber-junit, then to your surefire plugin you have to add properties, like so:


hope that helps, not sure what you expect to honor the argument once it's passed to cucumber-junit during execution, but maybe you've got that in place already.

Rex

Javix

unread,
Jul 26, 2012, 7:56:48 AM7/26/12
to cu...@googlegroups.com
Thank you for your help. I knew that. The idea was to be able to pass needed tag in the CLI when running
mvn test

I found another solution - by modifyng the options passed in the cucumber runner class as follows:
@RunWith(Cucumber.class)

//runnning features tagged with @person tag
@Cucumber.Options(tags = { "@person" }, format = "pretty")
public class RunCukeTest {

}
If one day I found a way to pass a needed tag from the CLI I'll share it with plaisure.
Thanks again.

Hristo Georgiev

unread,
Jul 28, 2012, 10:23:09 AM7/28/12
to cu...@googlegroups.com
Hi Jasvix,

The following works for me and I can pass parameters the way you wanted. I use integration-test phase.

Kind regards,

Hristo

    <properties>
        <tagArg>~@ignore</tagArg>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>${exec-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>Cucumber Command Line Runner</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <!-- automatically creates the classpath using all project dependencies,also adding the project build directory -->
                                <classpath/>
                                <argument>cucumber.cli.Main</argument>
                                <argument>--format</argument>
                                <argument>pretty</argument>
                                <argument>--format</argument>
                                <argument>html:target/cucumber-html-report</argument>
                                <argument>--strict</argument>
                                <argument>--glue</argument>
                                <argument>path.to.your.step.definitions</argument>
                                <argument>features/.</argument>
                                <argument>--tags</argument>
                                <argument>~@ignore</argument>
                                <argument>--tags</argument>
                                <argument>${tagArg}</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>


--
-- Rules --
 
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
 
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
 
 

Javix

unread,
Jul 30, 2012, 6:10:48 AM7/30/12
to cu...@googlegroups.com
Thanks, Hristo. I'll take a try later. For the moment it works fine like that, especially with Infinitest plugin well integrated in Eclipse.
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+unsubscribe@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
 
 

Reply all
Reply to author
Forward
0 new messages