Click here to Skip to main content
15,887,596 members
Home / Discussions / Java
   

Java

 
Questionneed to print the fullstr string to a textfile Pin
Member 1142765716-Aug-16 0:31
Member 1142765716-Aug-16 0:31 
QuestionDuplicate entry 'VALUE' for key 'PRIMARY' Pin
Django_Untaken13-Aug-16 9:54
Django_Untaken13-Aug-16 9:54 
AnswerRe: Duplicate entry 'VALUE' for key 'PRIMARY' Pin
Patrice T13-Aug-16 16:59
mvePatrice T13-Aug-16 16:59 
GeneralRe: Duplicate entry 'VALUE' for key 'PRIMARY' Pin
Django_Untaken14-Aug-16 3:28
Django_Untaken14-Aug-16 3:28 
GeneralRe: Duplicate entry 'VALUE' for key 'PRIMARY' Pin
Patrice T14-Aug-16 3:39
mvePatrice T14-Aug-16 3:39 
Question[SOLVED] java.lang.ClassNotFoundException: com.mysql.jdbc.Driver Pin
Django_Untaken4-Aug-16 8:35
Django_Untaken4-Aug-16 8:35 
AnswerRe: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver Pin
Richard MacCutchan4-Aug-16 20:38
mveRichard MacCutchan4-Aug-16 20:38 
QuestionMaven cmd line Tests failing,M aven Test Run Through Eclipse Pass Pin
DLamar123-Aug-16 8:29
DLamar123-Aug-16 8:29 
Hello all,

This is the circumstance. I am an QA Automation Engineer and right now I am being charged with setting up our CI framework in Jenkins but right now I am having issues with Maven. I am getting this error below when I try to run the mvn test command. However the tests work flawlessly in eclipse when run as maven test.
     T E S T S
    -------------------------------------------------------
    Running TestSuite
    Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configur
    ator@3830f1c0
    Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configur
    ator@bd8db5a
    Tests run: 16, Failures: 1, Errors: 0, Skipped: 14, Time elapsed: 0.66 sec <<< F
    AILURE!
    beforeTest(fcstestingsuite.fsnrgn.LoginTest)  Time elapsed: 0.442 sec  <<< FAILU
    RE!
    java.lang.IllegalStateException: The path to the driver executable must be set b
    y the webdriver.chrome.driver system property; for more information, see https:/
    /github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be dow
    nloaded from http://chromedriver.storage.googleapis.com/index.html
            at com.google.common.base.Preconditions.checkState(Preconditions.java:19
    9)
            at org.openqa.selenium.remote.service.DriverService.findExecutable(Drive
    rService.java:109)
            at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDrive
    rService.java:32)
            at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExe
    cutable(ChromeDriverService.java:137)
            at org.openqa.selenium.remote.service.DriverService$Builder.build(Driver
    Service.java:296)
            at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(C
    hromeDriverService.java:88)
            at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:116)
    
            at fcstestingsuite.fsnrgn.LoginTest.beforeTest(LoginTest.java:54)
    
    
    Results :
    
    Failed tests:   beforeTest(fcstestingsuite.fsnrgn.LoginTest): The path to the dr
    iver executable must be set by the webdriver.chrome.driver system property; for
    more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver.
    The latest version can be downloaded from http://chromedriver.storage.googleapis
    .com/index.html
    
    Tests run: 16, Failures: 1, Errors: 0, Skipped: 

14



As you can see it is related to my chrome system property/path. In my project I have a test package and page object package. I set my chrome system property in the object class and import that class into the test class which works fine in eclipse. I'm not quite sure why Maven is having an issue with this.

Sample code below
Java
Page Class 

    package pageobjectfactory;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.chrome.ChromeDriver;
    import org.openqa.selenium.support.FindBy;
    import org.testng.Assert;
    // URL = http://www.ourfsn.com/myfsn/
    
    public class Ourfsnlogin {
  
    	@FindBy(id="ctl00_ContentPlaceHolder1_tbxUname")
    	WebElement login;
    	@FindBy(id="ctl00_ContentPlaceHolder1_tbxPword")
    	WebElement password;
    	@FindBy(id="ctl00_ContentPlaceHolder1_btnSubmit")
    	WebElement submit;
    	@FindBy(name="ctl00$ContentPlaceHolder1$rptAccounts$ctl01$AccountSwitch")
    	WebElement PETSMARTUS;
    	@FindBy(name="ctl00$ContentPlaceHolder1$rptAccounts$ctl02$AccountSwitch")
    	WebElement PETSMARTCAD;
    	@FindBy(name="ctl00$ContentPlaceHolder1$rptAccounts$ctl03$AccountSwitch")
    	WebElement PETSMARTPR;
    	@FindBy(id="ctl00_lblTopLogin")
    	WebElement PETSMARTUSASSERT;
    	@FindBy(id="ctl00_lblTopLogin")
    	WebElement PETSMARTCAASSERT;
    	@FindBy(id="ctl00_lblTopLogin")
    	WebElement PETSMARTPRASSERT;
    	@FindBy(id="ctl00_Menu1_16")
    	WebElement LogoutButton;
    
   
    	public static WebDriver driver;
    	public static void main(String[] args) {
    		System.setProperty("webdriver.chrome.driver","C:\\Users\\dmohamed\\Documents\\Testing Environment\\Testing Environment\\Web Drivers\\chromedriver_win32 (1)\\chromedriver.exe");
    		WebDriver chromedriver = null; new ChromeDriver();
    
    
    		driver= chromedriver;
    
    
    	}
    
    
    	//Send user name in textbox 
    	public void sendUserName(String strUsername){
    		login.sendKeys("ebluth");}
    	public void sendUserNameServiceCenter(String strUsername){
    		login.sendKeys("servicecenter");}
    	public void sendUserNameSP(String strUsername){
    		login.sendKeys("4328701");
    	}
    	//Send Password
    	public void sendPassword(String strPassword){
    		password.sendKeys("password");}
    
    
    
    
    	//submitting credentials 
    	public void clicksubmit(){
    		submit.click();}
    	//Checking US PAge 
    	public void USAssertion(){
    		PETSMARTUS.isEnabled();
    	}
    	//Checking CAD page 
    	public void CAAssertion(){
    		PETSMARTCAD.isEnabled();}
    	//Checking PR Page 
    	public void PRAssertion(){
    		PETSMARTPR.isEnabled();}
    	//click us link
    
    	//Checking US PAge 
    	public void USclick(){
    		PETSMARTUS.click();
    	}
    	//Checking CAD page 
    	public void CAclick(){
    		PETSMARTCAD.click();}
    	//Checking PR Page 
    	public void PRclick(){
    		PETSMARTPR.click();}
    
    	//Click on
    	public void USPageValidation(){
    		Assert.assertTrue(PETSMARTUSASSERT.getText().contains("PETM-US"), "Incorrect Page [US,CA,PR]");
    
    	}
    	public void PRPageValidation(){
    		Assert.assertTrue(PETSMARTPRASSERT.getText().contains("PETM-PR"),"Incorrect Page [US,CA,PR]");
    	}
    	public void CAPageValidation(){
    		Assert.assertTrue(PETSMARTCAASSERT.getText().contains("PETM-CN"),"Incorrect Page [US,CA,PR]");
    	}
    	//Log out 
    
    	public void Logout (){
    		LogoutButton.click();
    
    
    
    	}}

    Test Class 
    package fcstestingsuite.fsnrgn;
    import org.testng.annotations.Test;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.chrome.ChromeDriver;
    import org.testng.annotations.BeforeTest;
    import org.testng.annotations.AfterMethod;
    import org.testng.annotations.AfterTest;
    import pageobjectfactory.Ourfsnlogin;
    import org.openqa.selenium.support.PageFactory;
    import org.openqa.selenium.support.pagefactory.AjaxElementLocatorFactory;
    
    public class LoginTest {
    	static WebDriver driver;
    	Ourfsnlogin LoginPage; 
    
    	@Test (priority=1)
    	public void USPageTest() {
    		LoginPage.sendUserName("ebluth");
    		LoginPage.sendPassword("password");
    		LoginPage.clicksubmit();
    		LoginPage.USclick();
    		LoginPage.USPageValidation();
    	}
    
    	@Test(priority=2)
    	public void CAPageTest(){
    		LoginPage.sendUserName("ebluth");
    		LoginPage.sendPassword("password");
    		LoginPage.clicksubmit();
    		LoginPage.CAclick();
    		LoginPage.CAPageValidation();
    	}
    
    
    	@Test (priority=3)
    	public void PRPageTest(){
    		LoginPage.sendUserName("ebluth");
    		LoginPage.sendPassword("password");
    		LoginPage.clicksubmit();
    		LoginPage.PRclick();
    		LoginPage.PRPageValidation();
    	}
    
    
    	@AfterMethod 
    	public void aftermethod(){
    		LoginPage.Logout();
    	}
    
    
    
    	@BeforeTest
    	public void beforeTest() {
    		Ourfsnlogin.driver=new ChromeDriver();
    		//setting global explicit wait 
    		PageFactory.initElements(new AjaxElementLocatorFactory(driver, 20), this);
    		Ourfsnlogin.driver.get("http://www.ourfsn.com/myfsn");
    		//initiating elements in page factory 
    		LoginPage= PageFactory.initElements(Ourfsnlogin.driver, Ourfsnlogin.class);
    
    	}
    
    	@AfterTest
    	public void afterTest() {
    		Ourfsnlogin.driver.quit();
    
    
    	}
    
    }

Any help would be greatly appreciated
AnswerRe: Maven cmd line Tests failing,M aven Test Run Through Eclipse Pass Pin
jschell12-Aug-16 10:54
jschell12-Aug-16 10:54 
Questionread and traverse over the TTL file Pin
Eng.Roqaya22-Jul-16 8:12
Eng.Roqaya22-Jul-16 8:12 
AnswerRe: read and traverse over the TTL file Pin
Richard MacCutchan22-Jul-16 21:25
mveRichard MacCutchan22-Jul-16 21:25 
Question.jar to .exe Pin
prateek chauhan19-Jul-16 18:47
prateek chauhan19-Jul-16 18:47 
AnswerRe: .jar to .exe Pin
Richard MacCutchan19-Jul-16 21:48
mveRichard MacCutchan19-Jul-16 21:48 
AnswerRe: .jar to .exe Pin
Afzaal Ahmad Zeeshan22-Jul-16 8:33
professionalAfzaal Ahmad Zeeshan22-Jul-16 8:33 
AnswerRe: .jar to .exe Pin
Curry Francis25-Jul-16 1:50
Curry Francis25-Jul-16 1:50 
GeneralRe: .jar to .exe Pin
Richard MacCutchan25-Jul-16 3:16
mveRichard MacCutchan25-Jul-16 3:16 
GeneralRe: .jar to .exe Pin
Curry Francis27-Jul-16 4:01
Curry Francis27-Jul-16 4:01 
GeneralRe: .jar to .exe Pin
Richard MacCutchan27-Jul-16 4:51
mveRichard MacCutchan27-Jul-16 4:51 
GeneralRe: .jar to .exe Pin
jschell12-Aug-16 10:58
jschell12-Aug-16 10:58 
QuestionJava - Iterating through form controls to create Array of Selected Items from Multiple JLists Pin
Member 1141797813-Jul-16 20:31
Member 1141797813-Jul-16 20:31 
AnswerRe: Java - Iterating through form controls to create Array of Selected Items from Multiple JLists Pin
Richard MacCutchan13-Jul-16 21:48
mveRichard MacCutchan13-Jul-16 21:48 
GeneralRe: Java - Iterating through form controls to create Array of Selected Items from Multiple JLists Pin
Member 1141797813-Jul-16 23:14
Member 1141797813-Jul-16 23:14 
GeneralRe: Java - Iterating through form controls to create Array of Selected Items from Multiple JLists Pin
Richard MacCutchan13-Jul-16 23:15
mveRichard MacCutchan13-Jul-16 23:15 
QuestionThe main purposes of learning java Pin
Ratul Thakur24-Jun-16 4:04
Ratul Thakur24-Jun-16 4:04 
AnswerRe: The main purposes of learning java Pin
Richard MacCutchan24-Jun-16 4:27
mveRichard MacCutchan24-Jun-16 4:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.