Issue
I am currently working on creating a Test Suite using Cucumber framework. I have created feature files for each of the functionality I have to test. The feature file never shows the conditions to be covered via glue code. On click of Recalculate steps it throws an error : An internal error occurred during: "Scanning for step definitions". java.lang.NullPointerException
I tried to change the path of glue in the Test Runner class but it did not solve the problem as well. The feature can be executed without any issue and the code runs fine, only issue is feature files keep on stating that there is no matching glue code.
#OrderInteraction
@Orders
Feature: Validating Order functionality
Background: Pre-requisites of Order Functionality
Given WebDriver is initialized
And Website is up and running
When User Enter "Username" and "Password" as Credentials
Then Validate User Login
Test Runner :
package Cucumber;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(features = "Features", glue=
{"src/main/java/CucumberStepDefinitions"})
public class CucumberTestRunner {
}
I would like to find a way in which Cucumber feature files can recognize the glue code present. Feel free to guide me to a existing question which answers this or a documentation which will be of help.
Solution
I finally was able to find the solution to this issue. Issue lies with the cucumber plugin version, I referred to Cucumber-Eclipse-Update-SiteSnapshot for resolution.
The steps were as below :
1.From Eclipse, go to menu Help > Install New software
2.Work with: https://cucumber.github.io/cucumber-eclipse-update-site-snapshot
3.Select the check-box for Cucumber Eclipse Plugin
4.Select Next as per the instruction shown during installation.
5.Restart your Eclipse after completion of instruction.
Once the plugin was updated Feature file automatically scanned for steps and found the matching glue code.
Answered By - Kovid Mehta
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.