Getting error regarding pico container in cucumber framework | Selenium Forum
S
sumit kalra Posted on 13/03/2019

Hi Ashish,

I have already added the pico container jar file in my maven based cucumber project.

Still I am getting the error "class com.qtpselenium.teststeps.loginTest doesn't have an empty constructor. If you need DI, put cucumber-picocontainer on the classpath"

screenshot attached.

below is the code of my loginTest.java

-------------------------------

public class loginTest {

WebConnector conn;

public loginTest(WebConnector conn)
{
this.conn=conn;
}



@Given("^I open (.*)$")
public void i_open(String browser)
{
System.out.println("I open-"+conn.name);
/*
if(browser.equals("firefox"))
driver=new FirefoxDriver();
else if(browser.equals("chrome"))
driver=new ChromeDriver();
*/
}

@And("^I navigate to (.*)$")
public void i_navigate(String browser)
{
System.out.println("i navigate to"+browser);
}



@And("^I type username as (.*) in (.*)$")
public void i_type_username(String username,String usernamefield)
{
System.out.println("I type username as username in usernamefield");
}

@And("^I type password as (.*) in (.*)$")
public void i_type_password(String password,String passwordfield)
{
System.out.println("I type password as username in passwordfield");
}
@And("^I click on (.*)$")
public void i_click(String button)
{
System.out.println("I click on"+button);
}

}

 


A
Ashish Thakur Replied on 15/03/2019

You need to have the same version of all cucumber-* in your pom.xml

 

Reference: https://stackoverflow.com/questions/33999071/project-doesnt-recognize-cucumber-picocontainer-dependency