Jenkins HtmlUnit is obsolete

111 views
Skip to first unread message

Pavel Baranchikov

unread,
Dec 2, 2014, 4:08:36 AM12/2/14
to jenkin...@googlegroups.com
Hello,

Jenkins has its own HtmlUnit module, that is downloaded throught Maven as dependency to jenkins test harness. But the module is rather old - as I understand it is of version 2.6 instead of 2.15 version of the original HtmlUnit.

This prevents me from testing my Html (with JavaScript)

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 19.895 sec <<< FAILURE! - in hudson.plugins.git.ui.ChangeSetListTest
test1(hudson.plugins.git.ui.ChangeSetListTest)  Time elapsed: 17.864 sec  <<< ERROR!
com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot find function querySelectorAll in object [object HTMLDocument]. (script in http://localhost:48448/job/test0/1/ from (45, 21) to (65, 14)#47)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3652)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3630)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3658)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3677)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3741)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2249)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2216)


The method querySelectorAll() support has been added since 2.9 according to http://htmlunit.sourceforge.net/changes-report.html

Is there a way to correctly replace HtmlUnit to the new version locally in my plugin's project?
Are there plans to renew Jenkins-shipped version of HtmlUnit?

Mirko Friedenhagen

unread,
Dec 3, 2014, 4:45:38 PM12/3/14
to jenkin...@googlegroups.com
Hello Pavel,

as Jenkins uses Maven, you should be able to override the version by
standard Maven means:
* Exclude the htmlunit stuff from the test-harness
* Then add the versions you want.

<dependencies>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-test-harness</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.jenkins-ci</groupId>
<artifactId>htmlunit</artifactId>
</exclusion>
<exclusion>
<groupId>org.jvnet.hudson</groupId>
<artifactId>htmlunit-core-js</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.15</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit-core-js</artifactId>
<version>2.15</version>
<scope>test</scope>
</dependency>
</dependencies>



Regards Mirko
--
http://illegalstateexception.blogspot.com/
https://github.com/mfriedenhagen/ (http://osrc.dfm.io/mfriedenhagen)
https://bitbucket.org/mfriedenhagen/
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-de...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/7daee6cd-a658-4676-aa3d-0d58c789ba59%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Pavel Baranchikov

unread,
Dec 9, 2014, 4:48:17 AM12/9/14
to jenkin...@googlegroups.com, Mirko Friedenhagen
Hello, Mirko

It seems to be impossible to just replace HtmlUnit with a new version,
because
org.jvnet.hudson.test.HudsonTestCase.WebClient.WebClient(HudsonTestCase) uses
field BrowserVersion.FIREFOX_2, which is no longer used in HtmlUnit.


Tests in error:
FailedTest.org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyTestSuite »
NoSuchField
PreBuildMergeOptionsTest.exporting:48 » NoSuchField FIREFOX_2
GitSCMTest>HudsonTestCase.runBare:296->HudsonTestCase.runTest:440-
>testConfigRoundtripURLPreserved:1229->HudsonTestCase.configRoundtrip:888-
>HudsonTestCase.createWebClient:1617 » NoSuchField
GitSCMTest>HudsonTestCase.runBare:296->HudsonTestCase.runTest:440-
>testConfigRoundtrip:1240->HudsonTestCase.configRoundtrip:888-
>HudsonTestCase.createWebClient:1617 » NoSuchField


So, new HtmlUnit substitution should make some problems, and, of course,
should cause every existing test to fail.
--

Best regards,
Pavel Baranchikov
Tuesday 09 December 2014

Pavel Baranchikov

unread,
Dec 9, 2014, 6:43:27 AM12/9/14
to jenkin...@googlegroups.com, mfried...@gmail.com
I wonder, whether Jenkins-patched HtmlUnit is still needed for Jenkins. Project https://github.com/jenkinsci/htmlunit/branches/all has no commits and changes for last 3 years.
Reply all
Reply to author
Forward
0 new messages