Grep Rules for Cucumber-Gherkin-JVM

42 views
Skip to first unread message

Vikram Upadhya

unread,
Sep 21, 2016, 9:33:50 AM9/21/16
to Cukes
Hi All,
 I am using these Jar's to generate the step defininitions.

I have a .feature which has the channel for a value referenced as below.


Scenario:
Given that US_1 is logged into the System
When the Parameter US_1 is available
Then the value for US_1 needs to be validated


Scenario:
Given that US_2 is logged into the System
When the Parameter US_2 is available
Then the value for US_2 needs to be validated


The Step definition is broken as it generates the step as
 "^that US_(//d+) is logged into the System$"  for US_1
 "^that US_(//d+) is logged into the System$"  for US_2

IS there a way to bypass the gherkin parser to generate stubs as US_1 and US_2?.

Regards,
Vikram_U_K

Jar's referenced:
cucumber-core-1.2.4.jar
cucumber-html-0.2.3.jar
cucumber-java-1.2.4.jar
cucumber-junit-1.2.4.jar
cucumber-jvm-deps-1.0.3.jar
cucumber-testng-1.2.0.jar
hamcrest-all.jar
hamcrest-core-1.3.jar
jacob-1.14.3.jar
junit-4.12.jar
gherkin-2.12.2.jar
gherkin-4.0.0.jar
gherkin-jvm-deps-1.0.4.jar

 

Thomas Sundberg

unread,
Sep 21, 2016, 2:25:54 PM9/21/16
to cu...@googlegroups.com
Hi!

On 21 September 2016 at 12:36, Vikram Upadhya <vikr...@gmail.com> wrote:
> Hi All,
> I am using these Jar's to generate the step defininitions.
>
> I have a .feature which has the channel for a value referenced as below.
>
>
> Scenario:
> Given that US_1 is logged into the System
> When the Parameter US_1 is available
> Then the value for US_1 needs to be validated
>
>
> Scenario:
> Given that US_2 is logged into the System
> When the Parameter US_2 is available
> Then the value for US_2 needs to be validated
>
>
> The Step definition is broken as it generates the step as
> "^that US_(//d+) is logged into the System$" for US_1
> "^that US_(//d+) is logged into the System$" for US_2
>
> IS there a way to bypass the gherkin parser to generate stubs as US_1 and
> US_2?.
>

I would implement that as a pre-step in my build process. That is, I
wouldn't consider bypassing Gherking, I would invoke a filter or
similar in Maven before executing the tests and feed a filtered
version to Cucumber.

HTH
Thomas

>
> Regards,
> Vikram_U_K
>
> Jar's referenced:
>
> cucumber-core-1.2.4.jar
> cucumber-html-0.2.3.jar
> cucumber-java-1.2.4.jar
> cucumber-junit-1.2.4.jar
> cucumber-jvm-deps-1.0.3.jar
> cucumber-testng-1.2.0.jar
> hamcrest-all.jar
> hamcrest-core-1.3.jar
> jacob-1.14.3.jar
> junit-4.12.jar
> gherkin-2.12.2.jar
> gherkin-4.0.0.jar
> gherkin-jvm-deps-1.0.4.jar
>
>
>
>
> --
> Posting rules: http://cukes.info/posting-rules.html
> ---
> You received this message because you are subscribed to the Google Groups
> "Cukes" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cukes+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://www.thinkcode.se/blog
Twitter: @thomassundberg

Better software through faster feedback

Vikram Upadhya

unread,
Sep 25, 2016, 6:11:47 PM9/25/16
to Cukes
Hi Thomas,
   Is there a way to get the Stubs generated as Unique for US_1 and US_2.

I am getting multiple stubs for US_(\\d+) and in both Upper(CucumberJVM) and lower case( Lettuce) implementation. 

All i need is the .feature steps for 

Scenario: 
Given that US_1 is logged into the System 
When the Parameter US_1 is available 
Then the value for US_1 needs to be validated 
 
 
Scenario: 
Given that US_2 is logged into the System 
When the Parameter US_2 is available 
Then the value for US_2 needs to be validated 


to generate Stubs as 
"^that US_(\\d+) is logged into the System$"  for US_1 
"^that US_(\\d+) is logged into the System$"  for US_2 


Is it possible to get this as a commandline to the Parser?. Any specific Version of gherkin i should use?.


regards,
Vikram U

George Dinwiddie

unread,
Sep 25, 2016, 6:37:43 PM9/25/16
to cu...@googlegroups.com
Vikram,

On 9/22/16 1:34 AM, Vikram Upadhya wrote:
> Hi Thomas,
> Is there a way to get the Stubs generated as Unique for US_1 and US_2.
>
> I am getting multiple stubs for US_(\\d+) and in both Upper(CucumberJVM)
> and lower case( Lettuce) implementation.
>
> All i need is the .feature steps for
>
> Scenario:
> Given that US_1 is logged into the System
> When the Parameter US_1 is available
> Then the value for US_1 needs to be validated
>
>
> Scenario:
> Given that US_2 is logged into the System
> When the Parameter US_2 is available
> Then the value for US_2 needs to be validated
>
>
> to generate Stubs as
> "^that US_(\\d+) is logged into the System$" for US_1
> "^that US_(\\d+) is logged into the System$" for US_2

I suggest editing the stubs that were generated.

- George.

--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------

Vikram Upadhya

unread,
Sep 26, 2016, 2:10:06 PM9/26/16
to Cukes
Hi George, Thomas,
  I found a Chrome Utility!!.. which solved the issue. Since i just need the stubs(camelcase/without numerals). 

think you would find this useful too.

regards,
Vikram U

On Wednesday, September 21, 2016 at 7:03:50 PM UTC+5:30, Vikram Upadhya wrote:
Reply all
Reply to author
Forward
0 new messages