Null pointer exception in StepDefinitions class.

122 views
Skip to first unread message

Phuoc Nguyen

unread,
Mar 17, 2016, 3:48:24 AM3/17/16
to Serenity BDD Users Group
Hi all,
    
    Could anyone help me about issue NullPointerException when running with CucumberWithSerenity.class?
    
    Below is the structure of my project:


         The AdminSteps is defined on ActorSteps and called it from MyStepdefs with annotations: @Steps.

         public class MyStepdefs {


@Steps
AdminSteps adminSteps;

@Then("^Verify Home page display$")
public void Verify_Home_page_display() throws Throwable {
adminSteps.should_see_the_homePage();
}

@Given("^I go to Login Page$")
public void I_go_to_Login_Page() throws Throwable {
// Express the Regexp above with the code you wish you had
adminSteps.open_LoginPage();
}

@When("^Login as (.*) and (.*)$")
public void Login_as_vanthao_gmail_com_and_password(String userName,String password) throws Throwable {
// Express the Regexp above with the code you wish you had
adminSteps.loginPage(userName, password);
}
}


     It's always throws the AdminSteps is Null. How can I do to fix this issue?


Thanks,

Phuoc

    

John Ferguson SmartSmart

unread,
Mar 17, 2016, 4:01:04 AM3/17/16
to Phuoc Nguyen, Serenity BDD Users Group
What package is MyStepdefs in?

___________________________________________________
John Smart | Wakaleo Consulting  |  +44 7398 832273
Making smart teams collaborate better
http://www.wakaleo.com  |  john....@wakaleo.com
___________________________________________________


On 17 March 2016 at 7:48:26 AM, Phuoc Nguyen (nguyen...@gmail.com) wrote:

MyStepdefs

Phuoc Nguyen

unread,
Mar 17, 2016, 4:14:56 AM3/17/16
to Serenity BDD Users Group, nguyen...@gmail.com
Hi John,
    The MyStepdefs is in com.runner.automation.web.stepsDefinitions. 

Sampathkumar S

unread,
Mar 18, 2016, 2:42:58 AM3/18/16
to Serenity BDD Users Group, nguyen...@gmail.com
Check your effective POM.xml is having proper versions of Java, Serenity BDD related artifacts, Selenium and JUNIT.

Thanks,
Sampath
Reply all
Reply to author
Forward
0 new messages