Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-3695

SeleniumHQ null pointer exception when running tests via batch file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • seleniumhq-plugin
    • None
    • Platform: All, OS: Windows XP

      We run Hudson slaves as services via the new WMI support that was added in
      Hudson 1.304. This causes a reproduceable problem with using the SeleniumHQ
      plugin though. Thankfully this problem is very easy to reproduce.

      First, a little background.

      In order to have Windows services be able to interact with the desktop, they
      need to run as the System account. Since the System account has no user profile
      (which Selenium RC wants), it is necessary to use something like SysInternals
      psexec utility which can run a process as a different user. This allows us to
      launch Selenium RC as a proper user account and then tests run properly.

      However, this means that we can not use the SeleniumHQ htmlSuite build step
      because of the need to wrap the launch command. Instead we have to create a
      build step of Windows batch so that we can invoke the psexec wrapper.

      After the test result is generated though, we get a null pointer exception when
      trying to publish the test result. Here is the stack trace from the log. The
      test result file has been generated properly at this point, and the "Publish
      Selenium Report" config is properly referencing the correct file name.

      Publishing Selenium report...
      FATAL: null
      java.lang.NullPointerException
      at
      hudson.plugins.seleniumhq.SeleniumhqPublisher.perform(SeleniumhqPublisher.java:117)
      at
      hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
      at
      hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
      at hudson.model.Build$RunnerImpl.post2(Build.java:183)
      at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
      at hudson.model.Run.run(Run.java:943)
      at hudson.model.Build.run(Build.java:112)
      at hudson.model.ResourceController.execute(ResourceController.java:93)
      at hudson.model.Executor.run(Executor.java:119)

      From a quick glance at the source code it looks like the plugin is expecting
      that the test result is always generated by the SeleniumHQ build step.

      Note that this can be reproduced by creating a job with a Windows batch build
      step that consists of one line that will create the result file to be published
      from an existing result file.

      type path\to\existing\result.html > expected\result.html

            pascal_martin pascal_martin
            chrisheller chrisheller
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: