Do you have questions ? We got the answers!

Ask a question:

0
Error running maven test in Jenkins

Open 1 Answers 178 Views

I have a maven test that runs ok from command prompt but when i run from jenkins there is an error. 

The command from jenkins is

cd /D E:\Sandeep\EclipseWorkspace\FirstDemo
mvn clean test

The error is-:

22:13:39 Building in workspace C:\Users\HOME\.jenkins\jobs\Hello world\workspace
22:13:39 [workspace] $ cmd /c call C:\Windows\TEMP\hudson2666917794181285488.bat
22:13:39 
22:13:39 C:\Users\HOME\.jenkins\jobs\Hello world\workspace>cd /D E:\Sandeep\EclipseWorkspace\FirstDemo 
22:13:39 
22:13:39 E:\Sandeep\EclipseWorkspace\FirstDemo>mvn clean test 
22:13:42 [INFO] Scanning for projects...
22:13:42 [INFO]                                                                         
22:13:42 [INFO] ------------------------------------------------------------------------
22:13:42 [INFO] Building FirstDemo 0.0.1-SNAPSHOT
22:13:42 [INFO] ------------------------------------------------------------------------
22:13:45 [INFO] 
22:13:45 [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ FirstDemo ---
22:13:45 [INFO] Deleting E:\Sandeep\EclipseWorkspace\FirstDemo\target
22:13:45 [INFO] 
22:13:45 [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ FirstDemo ---
22:13:45 [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
22:13:45 [INFO] Copying 0 resource
22:13:45 [INFO] 
22:13:45 [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ FirstDemo ---
22:13:46 [INFO] Nothing to compile - all classes are up to date
22:13:46 [INFO] 
22:13:46 [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ FirstDemo ---
22:13:46 [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
22:13:46 [INFO] Copying 0 resource
22:13:46 [INFO] 
22:13:46 [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ FirstDemo ---
22:13:46 [INFO] Changes detected - recompiling the module!
22:13:46 [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
22:13:46 [INFO] Compiling 1 source file to E:\Sandeep\EclipseWorkspace\FirstDemo\target\test-classes
22:13:48 [INFO] 
22:13:48 [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ FirstDemo ---
22:13:48 [INFO] Surefire report directory: E:\Sandeep\EclipseWorkspace\FirstDemo\target\surefire-reports
22:13:50 
22:13:50 -------------------------------------------------------
22:13:50  T E S T S
22:13:50 -------------------------------------------------------
22:13:51 Running com.google.tests.GoogleHomePageTest
22:13:51 Configuring TestNG with: [email protected]c4
22:13:53 Feb 09, 2017 10:13:53 PM org.openqa.selenium.remote.ProtocolHandshake createSession
22:13:53 INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
22:13:56 1486658636423	Marionette	INFO	Listening on port 51954
22:13:59 
22:13:59 ###!!! [Parent][MessageChannel] Error: (msgtype=0x4A0001,name=PContent::Msg_PBrowserConstructor) Channel error: cannot send/recv
22:13:59 
22:13:59 
22:13:59 ###!!! [Parent][MessageChannel] Error: (msgtype=0x4A0001,name=PContent::Msg_PBrowserConstructor) Channel error: cannot send/recv
22:13:59 
22:13:59 JavaScript error: chrome://global/content/bindings/remote-browser.xml, line 260: TypeError: frameLoader.tabParent is null
22:13:59 
22:13:59 ###!!! [Parent][MessageChannel] Error: (msgtype=0x2E007D,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
22:13:59 
22:13:59 JavaScript error: resource://app/modules/ContentCrashHandlers.jsm, line 75: TypeError: browser.permanentKey is not a non-null object
22:13:59 JavaScript error: chrome://global/content/bindings/remote-browser.xml, line 272: TypeError: frameLoader.tabParent is null
22:13:59 JavaScript error: chrome://global/content/bindings/remote-browser.xml, line 44: NS_ERROR_NOT_INITIALIZED: Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIMessageSender.sendAsyncMessage]
22:17:04 Build was aborted
4Comments
commented Feb 10 by stbadmin (4,970 points)
Are you running this commands from the same machine? I mean running mvn clean test on command line and Jenkins on the same machine? Also, your logs shows that you have issue with some chrome library. Are you executing your logs on Chrome?
commented Feb 11 by anonymous
I am running commands on same machine.  Test runs successfully when i run directly from command prompt. I don't know why there is error with chrome library.  I am not using logs on chrome.
commented Feb 11 by stbadmin (4,970 points)
Is that opening chrome window? Are you facing problem even  before chrome starts? Are you using new ChromeDriver() to  start chrome driver?
commented Feb 12 by anonymous
I m using firefox browser. My code is
package com.google.tests;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

public class GoogleHomePageTest {
   
    private WebDriver driver;
    String appURL = "http://google.com";

    @BeforeClass
    public void testSetUp() {
        System.setProperty("webdriver.gecko.driver", "C://Selenium driver/geckodriver.exe");
        DesiredCapabilities capabilities = DesiredCapabilities.firefox();
        capabilities.setCapability("marionette", true);

        driver = new FirefoxDriver();
    }
   
    @Test
    public void verifyGooglePageTittle() {
        driver.navigate().to(appURL);
        String getTitle = driver.getTitle();
        Assert.assertEquals(getTitle, "Google");
    }
   
    @AfterClass
    public void tearDown() {
        driver.quit();
    }
   
}

1 Answer

0
There can be two possibilities.

1. Your GWT is outdated. In that case, you will have to upgrade your Firefox browser. We had similar issue. But, after upgrading to Firefox version 50 we did not see this error.

2. Heap memory is not sufficient through Jenkins. To increase heap memory of Jenkins, edit Jenkins.xml file and update your heap size.

JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Xmx -XX:MaxPermSize="

Also, make sure that no gekodriver or Firefox process is running and clear temp file folder.

Let us know which solution works for you.
answered Feb 12 by stbadmin (4,970 points)
2Comments
commented Feb 13 by anonymous
I have updated Firefox. and cleared Temp folder contents. I could not edit jenkins.xml. Contents of jenkins.xml are
<service>
  <id>jenkins</id>
  <name>Jenkins</name>
  <description>This service runs Jenkins continuous integration system.</description>
  <env name="JENKINS_HOME" value="%BASE%" />
- <!--     if you'd like to run Jenkins with a specific version of Java, specify a full path to java.exe.
    The following value assumes that you have java in your PATH.
  
  -->
  <executable>java</executable>
  <arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>
- <!--     interactive flag causes the empty black Java window to be displayed.
    I'm still debugging this.
  <interactive />
  
  -->
  <logmode>rotate</logmode>
  <onfailure action="restart" />
  </service>
Where should I include new line.
commented Mar 3 by anonymous
You can pass this as an argument.

E.g.

<arguments>-Djava.awt.headless=true -Xmx -XX:MaxPermSize=512m  -Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>

Top Contributors

  • 4970 pointsstbadmin

    34 questions 454 answers218 comments

  • 430 pointsSunilBhaskar

    40 questions 14 answers26 comments

  • 425 pointsMehedi

    36 questions 3 answers14 comments

  • 354 pointsSoft Tester

    43 questions 0 answers4 comments

  • 342 pointssumitkumarwatts

    0 questions 12 answers0 comments

  • 327 pointsKeeshaGolden

    0 questions 17 answers2 comments

  • 322 pointsVipul Sharma

    44 questions 0 answers24 comments

  • 310 pointsvysh.sharma

    25 questions 0 answers0 comments

  • 267 pointsOnkar_Nimje

    33 questions 15 answers15 comments

  • 258 pointsVanitha

    26 questions 0 answers6 comments

...