Reputation: 3
My problem is related to picocontainer,i am not able to figure out what I am doing wrong when executing the test runner I am unable to find any scenarios or steps.However when I execute my old file the tests runs correctly which doesnot have picocontainer reference. My project contains following file 1) 1 Step definition 2) Feature File 2) Runner File 4) Test Context (Sharing state file,here I have mentioned webdriver and page object elements)
POM FIle
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.5</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>4.8.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>4.8.0</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-jvm-deps -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>4.8.0</version>
</dependency>
Feature File Feature: Automated End2End Tests Description: The Purpose of this feature is to test End 2 End integration.
Scenario:Customer place an order by purchasing an item from search Given user is on Home page When he search for "dress" And choose to buy the item for first time And moves to checkout from mini cart And enter personal details on checkout page and place the order
Step Definition
package stepDefinitions;
import cucumber.TestContext;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.When;
import pageObjects.HomePage;
public class HomePageSteps {
TestContext testContext;
HomePage homePage;
public HomePageSteps(TestContext context) {
this.testContext = context;
homePage = testContext.getPageObjectManager().getHomePage();
}
@Given("^user is on Home Page$")
public void user_is_on_Home_Page(){
homePage.navigateTo_HomePage();
}
@When("^he search for \"([^\"]*)\"$")
public void he_search_for(String product) {
homePage.perform_Search(product);
}
}
Runner File
package runners;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
//import cucumber.api.java.ObjectFactory;T
@RunWith(Cucumber.class)
@CucumberOptions(
// junit = "--step-notifications",
features = "src/test/resources/functionalTests",
glue= {"stepDefinitions"})
public class TestRunner {
}
Test Context
package cucumber;
import managers.PageObjectManager;
import managers.WebDriverManager;
public class TestContext {
private WebDriverManager webDriverManager;
private PageObjectManager pageObjectManager;
public TestContext(){
webDriverManager = new WebDriverManager();
pageObjectManager = new PageObjectManager(webDriverManager.getDriver());
}
public WebDriverManager getWebDriverManager() {
return webDriverManager;
}
public PageObjectManager getPageObjectManager() {
return pageObjectManager;
}
}
Upvotes: 0
Views: 174