Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor fails, if step definitions have constructor with dependency injection like pico-container. #303

Closed
phanikshr opened this issue Dec 12, 2018 · 15 comments

Comments

@phanikshr
Copy link

Getting error message "An internal error occurred during: "Scanning for step definitions".
java.lang.NullPointerException"

My stepdef file looks like

public class mynewstepdefs{
public String str1;
public int int1;
public mynewstepdefs(parallelcontext context){

}
}

@qvdk
Copy link
Member

qvdk commented Dec 29, 2018

Hi @phanikshr

The Cucumber Eclipse plugin does not use pico-container. Thus, your example can not work.

@qvdk qvdk closed this as completed Dec 29, 2018
@mikejramsey56
Copy link

mikejramsey56 commented Feb 22, 2019

phanikshr (or anyone else who finds their way here) check if your step definition specified

import cucumber.api.java.en.*;

If so, simply replace it with

import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;

@AlanBarrera
Copy link

@mikejramsey56 Brilliant!! That did the job for me. Thank you!

@qvdk
Copy link
Member

qvdk commented Apr 24, 2019

Could you provide a sample to reproduce your issue please ?

@AlanBarrera
Copy link

AlanBarrera commented Apr 24, 2019

@qvdk You can use my repo:

https://github.com/AlanBarrera/CucumberExercisesRepo

In the StepDefs_Register.java file, change these individual imports:

import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;

for:

import cucumber.api.java.en.*;

Then open the Register.feature and an error window should prompt.

@qvdk
Copy link
Member

qvdk commented Apr 25, 2019

Thanks @AlanBarrera I will take a look

@mikejramsey56
Copy link

Alan,
It took a late evening to figure that one out. Glad that it helped.

@skumardgl3
Copy link

phanikshr (or anyone else who finds their way here) check if your step definition specified

import cucumber.api.java.en.*;

If so, simply replace it with

import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;

It worked for me
Please explain the reason for this

@gliang-sugarcrm
Copy link

Thanks @mikejramsey56 ! Changing the '.*' to '.Then', 'When', ... etc works for me!

@gliang-sugarcrm
Copy link

I accidentally changed all the individual '.Then', '.When' ... to '.*' and hit the same issue immediately. Thanks again @mikejramsey56 .

@AmOkeyBright
Copy link

Please can anyone be of help to me. I have having those yellow signs in my feature file which says Step "XXXXXXX" does not have a matching glue code, though i have the step definitions. My feature files are in src/test/resources/Features folder while my stepDefinitions class are in src/test/java/steps package. I am relatively new to Cucumber
CucumberCapture
CucumberGlueCode

These are my cucumber dependencies

<dependency>
	<groupId>io.cucumber</groupId>
	<artifactId>cucumber-java</artifactId>
	<version>4.5.4</version>
</dependency>

<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng -->
<dependency>
	<groupId>io.cucumber</groupId>
	<artifactId>cucumber-testng</artifactId>
	<version>4.5.4</version>
</dependency>

@gliang-sugarcrm
Copy link

gliang-sugarcrm commented Aug 5, 2019 via email

@AlyyMagdy
Copy link

Please can anyone be of help to me. I have having those yellow signs in my feature file which says Step "XXXXXXX" does not have a matching glue code, though i have the step definitions. My feature files are in src/test/resources/Features folder while my stepDefinitions class are in src/test/java/steps package. I am relatively new to Cucumber
CucumberCapture
CucumberGlueCode

These are my cucumber dependencies

<dependency>
	<groupId>io.cucumber</groupId>
	<artifactId>cucumber-java</artifactId>
	<version>4.5.4</version>
</dependency>

<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng -->
<dependency>
	<groupId>io.cucumber</groupId>
	<artifactId>cucumber-testng</artifactId>
	<version>4.5.4</version>
</dependency>

If you're sure you include your step def file correct , just try to close the .feature file from your open tabs in eclipse and then open it again , you will notice the down in eclipse that there's a new scanning for step defs. Hope it will work with you!

@rakeshbg005
Copy link

rakeshbg005 commented Jan 10, 2020 via email

@TomasMorton
Copy link

Why on earth is it necessary to import each keyword separately?
Thanks for the fix @mikejramsey56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants