Sobhit Sharma
Sobhit Sharma

Reputation: 713

All feature files are not executing

Cucumber not executing both the features with created stepdefinations

I have tried with tag, also given both full path of both the features but still the same

package runners;

import com.cucumber.listener.ExtentProperties;
import com.cucumber.listener.Reporter;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import managers.Common;
import managers.FileReader;
import org.apache.log4j.PropertyConfigurator;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import java.io.File;

@RunWith(Cucumber.class)
@CucumberOptions(
        features = ".//src//test//java//FeatureList",glue = "stepDefinations",
        plugin = { "com.cucumber.listener.ExtentCucumberFormatter:",
                "junit:target/cucumber-results.xml"},
        tags={"@API"},
        monochrome = true
)
public class TestRunner {

    static String ReportName= Common.ReportName();

    @BeforeClass
    public static void setup() {

        ExtentProperties extentProperties = ExtentProperties.INSTANCE;
        extentProperties.setReportPath("target/cucumber-reports/"+ReportName+".html");
        PropertyConfigurator.configure(".//src//log4j.properties");
    }

    @AfterClass
    public static void writeExtentReport() {

        Reporter.loadXMLConfig(new File(FileReader.getInstance().getConfigReader().getReportConfigPath()));
        Reporter.setSystemInfo("User Name", System.getProperty("user.name"));
        Reporter.setSystemInfo("Time Zone", System.getProperty("user.timezone"));
        Reporter.setSystemInfo("Environment", FileReader.getInstance().getConfigReader().getEnvironment());
    }
}

Not sure why its always running error codes.feature but never enums.feature

enter image description here

Feature: Enums Codes @API Scenario: xxx Enums Codes Given Run get method "xxxxxxxxxxx" api to get fetch all type of xxx xxx Then response should be 200 And xxxxxxxxxxxxxx

Feature: Error Codes

@API Scenario: xxError Codes Given Run "xxxx" api to get response Then response should be 200 And Verify xx Error Codes xx error response

Upvotes: 1

Views: 306

Answers (1)

Shrikant More
Shrikant More

Reputation: 146

"features" is looking for a filesystem path:

features = ".//src//test//java//FeatureList"

Try this - 1 features = "src/test/java/FeatureList" 2 features = "FeatureList"

Upvotes: 1

Related Questions