How to set project.build.directory in maven?

529 views
Skip to first unread message

Phuoc Nguyen

unread,
Apr 11, 2016, 5:25:29 AM4/11/16
to Serenity BDD Users Group
Hi guys,
    When I try to run the test with jUnit, it's always return to NullPointerException with these lines:
286 [main] INFO net.thucydides.core.webdriver.SystemPropertiesConfiguration - project.build.directory : null
287 [main] INFO net.thucydides.core.webdriver.SystemPropertiesConfiguration - project.reporting.OutputDirectory : null

    Does this issue's telling that cause I'm don't have the default URL for project.build.directory? How can I set these value in maven or somewhere else? 
    I'm using:
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>${serenity.version}</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-junit</artifactId>
<version>${serenity.version}</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-screenplay</artifactId>
<version>${serenity.version}</version>
</dependency>

    All of them are latest version - 1.1.29-rc.3.

    Please take a look and help me. 
Thank you. 

John Ferguson SmartSmart

unread,
Apr 11, 2016, 5:27:49 AM4/11/16
to Phuoc Nguyen, Serenity BDD Users Group
Could you describe the nature of the problem more precisely? Are you getting an exception with a stack trace? Are the tests running at all?

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

--
You received this message because you are subscribed to the Google Groups "Serenity BDD Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thucydides-use...@googlegroups.com.
To post to this group, send email to thucydid...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Phuoc Nguyen

unread,
Apr 11, 2016, 5:55:46 AM4/11/16
to Serenity BDD Users Group, nguyen...@gmail.com
Hi John, 

   This is my project structure:


     When I run LoginFeatures.java as SerenityJunit, the console display the SERENITY - STARTED and after that TEST FAILED with the trace: Null pointer exception as the line that I show you. 

       
    I just try to learn with Serenity Framework by java and running on MacOS. 

John Ferguson SmartSmart

unread,
Apr 11, 2016, 5:59:45 AM4/11/16
to Phuoc Nguyen, Serenity BDD Users Group, nguyen...@gmail.com
That is an info message that just means that you haven’t overridden the default output message. Do you get the test reports generated in target/site/serenity?

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


Phuoc Nguyen

unread,
Apr 11, 2016, 6:19:32 AM4/11/16
to Serenity BDD Users Group, nguyen...@gmail.com
Thanks John, 
    If that, I don't need to override them. I'm able to get the test report. Hmm, but I still get Null pointer when trying to open the Page. :(

John Ferguson SmartSmart

unread,
Apr 11, 2016, 6:20:49 AM4/11/16
to Phuoc Nguyen, Serenity BDD Users Group, nguyen...@gmail.com
Could you elaborate on what you mean by “Null pointer”?

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


Phuoc Nguyen

unread,
Apr 11, 2016, 6:30:14 AM4/11/16
to Serenity BDD Users Group, nguyen...@gmail.com
Hi John,
   This is my feature test:

@RunWith(SerenityRunner.class)
public class LoginFeatures {
@Steps
OrdererSteps ordererSteps;
@Title("Ensure normal user can login with valid password")
@Test
public void shouldGotoHomePage(){
ordererSteps.openLoginPage();
ordererSteps.loginToHomePage("scor...@gmail.com","abc123456");
}
}

In OrdererSteps, I implement like that:
public class OrdererSteps{
LoginPage loginPage;
@Step("Open the login page")
public void openLoginPage(){
// GIVEN
loginPage.open();
loginPage.getDriver().manage().window().maximize();
}
@Step("Login to home page")
public void loginToHomePage(String email, String pwd){
// WHEN
loginPage.clickGetStartedLink();
// AND
loginPage.enterToEmailInput(email);
// AND
loginPage.enterToPwdInput(pwd);
// AND
loginPage.clickLoginButton();
// THEN the homepage display
}
}
I don't know why the at the line loginPage.open(), console throws the null pointer although in Login Page, I've already have @DefaultUrl(http://www.google.com).
UTC+7, John Smart wrote:

John Ferguson SmartSmart

unread,
Apr 11, 2016, 6:34:15 AM4/11/16
to Phuoc Nguyen, Serenity BDD Users Group, nguyen...@gmail.com
Can you post your LoginPage  class?

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


Phuoc Nguyen

unread,
Apr 11, 2016, 6:37:42 AM4/11/16
to Serenity BDD Users Group, nguyen...@gmail.com
Hi John,
    Please take a look at my LoginPage class:
    @DefaultUrl("https://www.testloginpage.com/#/")
public class LoginPage extends PageObject {
@FindBy(xpath = "//div[@class='inner-background animated fadeInDown']/a[@ng-click='show_login_holder()']")
private WebElementFacadeImpl getStartedLink;
@FindBy(xpath = "//*[@id='login_email']")
private WebElementFacadeImpl emailInput;
@FindBy(xpath = "//*[@id='login_password']")
private WebElementFacadeImpl pwdInput;
@FindBy (xpath = ".//*[@id='login_holder']//button[@type='submit']")
private WebElementFacadeImpl loginButton;
public void clickGetStartedLink(){
getStartedLink.click();
}
public void enterToEmailInput(String email){
emailInput.sendKeys(email);
}
public void enterToPwdInput(String pwd){
pwdInput.sendKeys(pwd);
}
public void clickLoginButton(){
loginButton.click();
_______________________________________________
Reply all
Reply to author
Forward
0 new messages