SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    New Member
    Join Date
    Jan 2015
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Selenium Test script works fine on eclipse but not from Jenkins

    I have squash TA project (maven project) with the following selenium test script. When I run it via eclipse using chrome and IE drivers it works fine and test executes successfully but when i integrate the build with Jenkins, it fails with the below error

    [ERROR] org.squashtest.ta.backbone.tools.ReflectionUtils - Test Automation Engine error (non SUT) : method 'convert' from engine component of class 'org.squashtest.ta.plugin.commons.converter.FileTo JavaCodeBundle' with argument 'org.squashtest.ta.framework.components.FileResour ce' has thrown an exception. java.lang.NullPointerException at org.squashtest.ta.plugin.commons.library.java.Comp ilerConnector.compile(CompilerConnector.java:103) at org.squashtest.ta.plugin.commons.converter.FileToJ avaCodeBundle.convert(FileToJavaCodeBundle.java:10 8) at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.squashtest.ta.backbone.tools.ReflectionUtils.i nvoke(ReflectionUtils.java:253) at org.squashtest.ta.backbone.engine.wrapper.Resource ConverterHandler.convert(ResourceConverterHandler. java:103) at org.squashtest.ta.backbone.engine.instructionrunne r.DefaultConvertResourceRunner.applyConverter(Defa ultConvertResourceRunner.java:130) at org.squashtest.ta.backbone.engine.instructionrunne r.DefaultConvertResourceRunner.convertResource(Def aultConvertResourceRunner.java:94) at org.squashtest.ta.backbone.engine.instructionrunne r.DefaultConvertResourceRunner.doRun(DefaultConver tResourceRunner.java:54) at org.squashtest.ta.backbone.engine.instructionrunne r.AbstractDefaultInstructionRunner.run(AbstractDef aultInstructionRunner.java:70) at org.squashtest.ta.backbone.engine.impl.TestRunnerI mpl.runPhase(TestRunnerImpl.java:158) at org.squashtest.ta.backbone.engine.impl.TestRunnerI mpl.runTest(TestRunnerImpl.java:122) at org.squashtest.ta.backbone.engine.impl.EcosystemRu nnerImpl.runAllTests(EcosystemRunnerImpl.java:183) at org.squashtest.ta.backbone.engine.impl.EcosystemRu nnerImpl.run(EcosystemRunnerImpl.java:98) at org.squashtest.ta.backbone.engine.impl.SuiteRunner Impl.execute(SuiteRunnerImpl.java:68) at org.squashtest.ta.backbone.engine.impl.EngineImpl. execute(EngineImpl.java:64) at org.squashtest.ta.maven.SquashTAMojo.executeImpl(S quashTAMojo.java:212) at org.squashtest.ta.maven.AbstractSquashTaMojo.execu te(AbstractSquashTaMojo.java:197) at org.apache.maven.plugin.DefaultBuildPluginManager. executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.e xecute(MojoExecutor.java:209) at org.apache.maven.lifecycle.internal.MojoExecutor.e xecute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.e xecute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModul eBuilder.buildProject(LifecycleModuleBuilder.java: 84) at org.apache.maven.lifecycle.internal.LifecycleModul eBuilder.buildProject(LifecycleModuleBuilder.java: 59) at org.apache.maven.lifecycle.internal.LifecycleStart er.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStart er.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMav en.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven .java:156) at org.jvnet.hudson.maven3.launcher.Maven3Launcher.ma in(Maven3Launcher.java:117) at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.codehaus.plexus.classworlds.launcher.Launcher. launchStandard(Launcher.java:329) at org.codehaus.plexus.classworlds.launcher.Launcher. launch(Launcher.java:239) at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Ma ven3Main.java:178) at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source) at java.lang.reflect.Method.invoke(Unknown Source) at hudson.maven.Maven3Builder.call(Maven3Builder.java :136) at hudson.maven.Maven3Builder.call(Maven3Builder.java :71) at hudson.remoting.UserRequest.perform(UserRequest.ja va:121) at hudson.remoting.UserRequest.perform(UserRequest.ja va:49) at hudson.remoting.Request$2.run(Request.java:324) at hudson.remoting.InterceptingExecutorService$1.call (InterceptingExecutorService.java:68) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source) at java.lang.Thread.run(Unknown Source) [ERROR] org.squashtest.ta.backbone.engine.impl.TestRunnerI mpl - The execution raised an error in the TEST phase of the TA script 'PetStoreSeleniumTest.ta' with the message: 'Test Automation Engine error (non SUT) : method 'convert' from engine component of class 'org.squashtest.ta.plugin.commons.converter.FileTo JavaCodeBundle' with argument 'org.squashtest.ta.framework.components.FileResour ce' has thrown an exception.'.

    Which seems to be generic error thrown by squash TA whenever the test script fails. Have seen similar error when the test failed in eclipse for firefox driver

    One thing to note is that on executing the script using chrome driver in eclipse wherein i set the driver path in the script, in the console I can see below statement Starting ChromeDriver 2.13.307647 (5a7d0541ebc58e69994a6fb2ed930f45261f3c29) on port 55057 Only local connections are allowed.

    Similar sort of message when referring to IE drivers

    But on running the same job in jenkins, similar message not seen and the test fails at the same point in the console wherein I can see the above message related to "Only local connections are allowed"

    Test Script:

    import java.util.regex.Pattern;
    import java.util.concurrent.TimeUnit;
    import org.junit.*;
    import static org.junit.Assert.*;
    import static org.hamcrest.CoreMatchers.*;
    import org.openqa.selenium.*;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.chrome.ChromeDriver;
    import org.openqa.selenium.support.ui.Select;

    public class Test1{
    private WebDriver driver;
    private String baseUrl;
    private boolean acceptNextAlert = true;
    private StringBuffer verificationErrors = new StringBuffer();

    @Before
    public void setUp() throws Exception {
    System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
    driver = new ChromeDriver();
    //driver = new FirefoxDriver();
    baseUrl = "http://localhost:8080/";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    }

    @test
    public void testPetStoreSelenium() throws Exception {
    driver.get(baseUrl);
    driver.findElement(By.linkText("Enter the Store")).click();
    driver.findElement(By.xpath("//tr[5]/td/a/img")).click();
    driver.findElement(By.xpath("//tr[3]/td/b/a/font")).click();
    driver.findElement(By.xpath("//tr[3]/td[5]/a/img")).click();
    driver.findElement(By.xpath("//td[2]/center/a/img")).click();
    driver.findElement(By.xpath("//center[2]/a/img")).click();
    driver.findElement(By.name("username")).clear();
    driver.findElement(By.name("username")).sendKeys(" j2ee");
    driver.findElement(By.name("password")).clear();
    driver.findElement(By.name("password")).sendKeys(" j2ee");
    driver.findElement(By.name("update")).click();
    driver.findElement(By.cssSelector("p > input[type=\"image\"]")).click();
    driver.findElement(By.xpath("//center[3]/a/img")).click();
    }

    @After
    public void tearDown() throws Exception {
    driver.quit();
    String verificationErrorString = verificationErrors.toString();
    if (!"".equals(verificationErrorString)) {
    fail(verificationErrorString);
    }
    }

    private boolean isElementPresent(By by) {
    try {
    driver.findElement(by);
    return true;
    } catch (NoSuchElementException e) {
    return false;
    }
    }

    private boolean isAlertPresent() {
    try {
    driver.switchTo().alert();
    return true;
    } catch (NoAlertPresentException e) {
    return false;
    }
    }

    private String closeAlertAndGetItsText() {
    try {
    Alert alert = driver.switchTo().alert();
    String alertText = alert.getText();
    if (acceptNextAlert) {
    alert.accept();
    } else {
    alert.dismiss();
    }
    return alertText;
    } finally {
    acceptNextAlert = true;
    }
    } }

    Has anyone encountered similar error ? If yes, whats the fix for it

  2. #2
    SQA Knight
    Join Date
    May 2006
    Location
    Playa Del Rey, California, United States
    Posts
    2,594
    Post Thanks / Like
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    Usually that's a problem with your build script or your CI configuration.

    I'd probably check the following,

    1) Verify your test agents on jenkins are using the same version of the platform and build process (like same maven version)

    2) Verify that you can build and run your tests from the command line. If it can't run on command line, it's most likely not going to work on Jenkins.

    3) Verify on the Test Agents, your paths and other environment variables are in line.

    4) Try to check out your project from source control and run it from the command line from the TestAgent machine to debug any other issues.
    David Lai
    SDET / Consultant
    LinkedIn profile

  3. #3
    New Member
    Join Date
    Jan 2015
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    @David: You were correct. I should have attempted test run using command prompt

    Its running into same error from command line as well

  4. #4
    New Member
    Join Date
    Jan 2015
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    @David: You were correct. It doesn't run on command line prompt as well

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 09:54 PM.

Copyright BetaSoft Inc.