Message from discussion
JVM - passing a tag does not work
Date: Thu, 26 Jul 2012 04:56:48 -0700 (PDT)
From: Javix <s.camb...@gmail.com>
To: cukes@googlegroups.com
Message-Id: <bf1b0ea6-c078-4a24-9dfe-3f8aa91ae0ae@googlegroups.com>
In-Reply-To: <087c8a2d-b8d9-424a-b5a7-6bf35953be5f@googlegroups.com>
References: <41666e95-2ee5-4db9-81d5-0731d1a75aed@googlegroups.com>
<087c8a2d-b8d9-424a-b5a7-6bf35953be5f@googlegroups.com>
Subject: Re: JVM - passing a tag does not work
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_899_25458863.1343303808319"
------=_Part_899_25458863.1343303808319
Content-Type: multipart/alternative;
boundary="----=_Part_900_994038.1343303808319"
------=_Part_900_994038.1343303808319
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Thank you for your help. I knew that. The idea was to be able to pass=20
needed tag in the CLI when running=20
mvn test
I found another solution - by modifyng the options passed in the cucumber=
=20
runner class as follows:
@RunWith(Cucumber.class)
//runnning features tagged with @person tag
@Cucumber.Options(tags =3D { "@person" }, format =3D "pretty")
public class RunCukeTest {
}
If one day I found a way to pass a needed tag from the CLI I'll share it=20
with plaisure.
Thanks again.
Le mercredi 25 juillet 2012 22:18:46 UTC+2, Rex Hoffman a =C3=A9crit :
>
> 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=20
> these system parameters.
>
> If you're using the cucumber-junit, then to your surefire plugin you have=
=20
> to add properties, like so:
>
>
> http://maven.apache.org/plugins/maven-surefire-plugin/examples/system-pro=
perties.html
>
> hope that helps, not sure what you expect to honor the argument once it's=
=20
> passed to cucumber-junit during execution, but maybe you've got that in=
=20
> place already.
>
> Rex
>
> On Monday, July 23, 2012 7:40:23 AM UTC-7, Javix wrote:
>>
>> 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=20
>> cucumber-jvm distribution. Then I ran it as explained:
>> mvn clean test -DtagArg=3D"@hello"
>>
>> Nevertheless all the features were run. What did I wrong?=20
>> OS: Windows XP Pro SP3, Ruby 1.9.3; Cucumber version: (1.2.1)
>> Thank you.
>>
>>
------=_Part_900_994038.1343303808319
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Thank you for your help. I knew that. The idea was to be able to pass neede=
d tag in the CLI when running <br><div class=3D"prettyprint" style=3D"backg=
round-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-s=
tyle: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"pret=
typrint"><div class=3D"subprettyprint"><span style=3D"color: #000;" class=
=3D"styled-by-prettify">mvn test</span></div></code></div><br>I found anoth=
er solution - by modifyng the options passed in the cucumber runner class a=
s follows:<br><div class=3D"prettyprint" style=3D"background-color: rgb(250=
, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-=
width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #066;" class=3D"styled-by-prettif=
y">@RunWith</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>(</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Cucumber=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.</span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">class</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"col=
or: #800;" class=3D"styled-by-prettify">//runnning features tagged with @pe=
rson tag</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r></span><span style=3D"color: #066;" class=3D"styled-by-prettify">@Cucumbe=
r</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.</span><=
span style=3D"color: #606;" class=3D"styled-by-prettify">Options</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">tags </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-pr=
ettify">"@person"</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">},=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> format </=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #080;" class=3D"styled-by-prettify">"pretty"</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">public</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prett=
ify">RunCukeTest</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span></div>=
</code></div>If one day I found a way to pass a needed tag from the CLI I'l=
l share it with plaisure.<br>Thanks again.<br><br><br>Le mercredi 25 juille=
t 2012 22:18:46 UTC+2, Rex Hoffman a =C3=A9crit :<blockquote class=3D"=
gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc so=
lid;padding-left: 1ex;">You need to pass the parameter in to your test exec=
ution jvm run.<div><br></div><div>Your tests are probably run in a forked j=
vm just so they don't include these system parameters.</div><div><br></div>=
<div>If you're using the cucumber-junit, then to your surefire plugin you h=
ave to add properties, like so:</div><div><br></div><div><a href=3D"http://=
maven.apache.org/plugins/maven-surefire-plugin/examples/system-properties.h=
tml" target=3D"_blank">http://maven.apache.org/<wbr>plugins/maven-surefire-=
plugin/<wbr>examples/system-properties.<wbr>html</a></div><div><br></div><d=
iv>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 p=
lace already.</div><div><br></div><div>Rex<br><br>On Monday, July 23, 2012 =
7:40:23 AM UTC-7, Javix wrote:<blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">I tri=
ed to tag a feature like that:<br><div style=3D"background-color:rgb(250,25=
0,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;wo=
rd-wrap:break-word"><code><div><span style=3D"color:#066">@hello</span><spa=
n style=3D"color:#000"><br></span><span style=3D"color:#606">Feature</span>=
<span style=3D"color:#660">:</span><span style=3D"color:#000"> </span><span=
style=3D"color:#606">Hello</span><span style=3D"color:#000"> </span><span =
style=3D"color:#606">World</span><span style=3D"color:#000"><br><br> =
</span><span style=3D"color:#606">Scenario</span><span style=3D"color:#660"=
>:</span><span style=3D"color:#000"> </span><span style=3D"color:#606">Say<=
/span><span style=3D"color:#000"> hello<br> </span><span style=
=3D"color:#606">Given</span><span style=3D"color:#000"> I have a hello app =
</span><span style=3D"color:#008">with</span><span style=3D"color:#000"> </=
span><span style=3D"color:#080">"Howdy"</span><span style=3D"color:#000"><b=
r> </span><span style=3D"color:#606">When</span><span style=3D=
"color:#000"> I ask it to say hi<br> </span><span style=3D"col=
or:#606">Then</span><span style=3D"color:#000"> it should answer </span><sp=
an style=3D"color:#008">with</span><span style=3D"color:#000"> </span><span=
style=3D"color:#080">"Howdy World"</span></div></code></div><br>it is just=
a modified feature took from the examples folder of cucumber-jvm distribut=
ion. Then I ran it as explained:<br><div style=3D"background-color:rgb(250,=
250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;=
word-wrap:break-word"><code><div><span style=3D"color:#000">mvn clean test =
</span><span style=3D"color:#660">-</span><span style=3D"color:#606">DtagAr=
g</span><span style=3D"color:#660">=3D</span><span style=3D"color:#080">"@h=
ello"</span></div></code></div><br>Nevertheless all the features were run. =
What did I wrong? <br>OS: Windows XP Pro SP3, Ruby 1.9.3; Cucumber version:=
(1.2.1)<br>Thank you.<br><br></blockquote></div></blockquote>
------=_Part_900_994038.1343303808319--
------=_Part_899_25458863.1343303808319--