[JVM] Step does not have a matching glue code error in eclipse

353 views
Skip to first unread message

Rajesh V

unread,
Jul 15, 2019, 3:44:11 PM7/15/19
to Cukes

Hi,
I am pretty new to Cucumber-Java development. I have written a Scenario shown below along with a StepDef.java with matching glue code, however in my eclipse I see an error "Step does not have a matching glue code"


My BDD:

 Scenario: test scenario
    Given I have testResource defined
    When it contains listener
 

StepDef.java

@Given("^I have \"([^\"]*)\" defined$")
	public void i_have_resource_defined(String searchResourceType) throws Exception {
.......
}
 

Error message I see in eclipse: Step 'I have testResource defined' does not have a matching glue code

However, when I change the Scenario to Scenario Outline as shown below, the BDD works fine

Scenario Outline: test scenario
   Given I have "<resource>" defined
    When it contains "<property>"
    
    Examples:
    | resource                   | property        |
    | testResource             |  listener         |

I am not sure what I am missing here, and why my Scenario is not working and Scenario Outline works.

I am using cucumber v 4.2.6

Java 8

any help/input is greatly appreciated. Thanks!

Mark Jordan

unread,
Jul 15, 2019, 3:53:05 PM7/15/19
to Cukes
Maybe drop the quotation marks in your step def? You have them in your scenario outline, but not the scenario. You don't need them at all. I'd get rid of them and write your steps like you have in your regular scenario.

Oleg Manzhos

unread,
Jul 15, 2019, 3:58:11 PM7/15/19
to cu...@googlegroups.com
I'm not 100% sure, but glue code is something in runner class @CucumberOptions(...glue={path.to.definition}

пн, 15 июл. 2019 г., 21:53 Mark Jordan <markmj...@gmail.com>:
Maybe drop the quotation marks in your step def? You have them in your scenario outline, but not the scenario. You don't need them at all. I'd get rid of them and write your steps like you have in your regular scenario.

--
Posting rules: https://cucumber.io/support/posting-rules
---
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/cukes/0c20c006-f2a9-475a-84e8-4675f4ec4ec4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rajesh V

unread,
Jul 15, 2019, 4:20:11 PM7/15/19
to Cukes
Thanks for the quick reply.

I think I figured out the problem.

My BDD:

 Scenario: test scenario
    Given I have "testResource" defined
    When it contains "listener"

The BDD worked. I had to add quotes ("") around the dynamic value we want to pass to the step def.
Reply all
Reply to author
Forward
0 new messages