Trap in issue for Pico Container | Selenium Forum
A
ajaypardhi.engg Posted on 26/12/2019

Hi Ashish,

I am getting trapped in an issue related to cucumber picocontainer.

My step defination HomePageSteps is not being executed.For this I have used Picocontainer.

I have shared Test steps Throgh Test context file.

 

Following warnings are displayed 

 

Dec 26, 2019 8:22:41 PM cucumber.runtime.java.ObjectFactoryLoader loadSingleObjectFactory
INFO: Loading ObjectFactory via service loader: io.cucumber.picocontainer.PicoFactory

 

I am attaching My POM.xml.

May be this is an issue of version compatibilty with cucumber.

 

Regards,

Ajay


A
ajaypardhi.engg Replied on 30/12/2019

Now I am not getting error but steps are not getting implemented error is displayed.

1 Scenarios ([33m1 undefined[0m)
5 Steps ([36m1 skipped[0m, [33m4 undefined[0m)
0m0.000s


You can implement missing steps with the snippets below:

@Given("^user is on Home page$")
public void user_is_on_Home_page() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}

@When("^choose to buy the item for first time$")
public void choose_to_buy_the_item_for_first_time() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}

@When("^moves to checkout from mini cart$")
public void moves_to_checkout_from_mini_cart() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}

@When("^enter personal details on checkout page and place the order$")
public void enter_personal_details_on_checkout_page_and_place_the_order() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}

My 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.7.0</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>

</dependencies>

My 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

 

My Step Defination file

public class HomePageSteps {



TestContext testContext;
HomePage homePage;

public HomePageSteps(TestContext context) {
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);
}

}

TestContext File:

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;
}

}


Related Posts