Introduction
At any time, all the code in the git repository should be compilable and should pass all the unit tests. There is no guarantee that it will be full featured - this is a work in progress.
Latest build
You can download the latest build from our Build server.
Maven snapshot
Sonatype OSS repository hosts HtmlUnit snapshot, which is manually updated by the team once in a while. To use that, you can include the below in your POM:
<project> ... <repositories> <repository> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> <releases> <enabled>false</enabled> </releases> <id>sonatype-nexus-snapshots</id> <name>Sonatype Nexus Snapshots</name> <url>https://oss.sonatype.org/content/repositories/snapshots</url> <layout>default</layout> </repository> </repositories> </project>
The source code repository
The source code is hosted at GitHub.
Compiling the code
The preferred way to build HtmlUnit is with maven 3.
At least for running the complete test suite a 64 bit JDK is required.
mvn compile
This will do an incremental compile of all the code.
mvn clean compile
This will do a clean compile of all the code.
Dependencies for IDE
Usually, you need to get the JARs for your IDE. You can do that by something like:
Eclipse: right click on the project -> Configure -> Convert to Maven Project
, alternatively:
mvn eclipse:eclipse
or
mvn idea:idea
This will create appropriate IDE project. Note that HtmlUnit is mostly at the bleeding edge, to the extent that an HtmlUnit-local repository has been created to store snapshots of various dependencies.
Running the tests
All the tests are based on JUnit.
mvn test
This will force a recompile of the java classes if needed.
mvn test -Dtest=DomNodeTest
This will run only the specified test class.
Tests currently assume that port 12345 is free on the machine,
if you have java.net.BindException: Address already in use: JVM_Bind
,
then set the system property htmlunit.test.port
e.g. -Dhtmlunit.test.port=10101
.
Additionally class SocksProxyTest requires a SOCKS Proxy running at port 55555.
Packaging
mvn package
In the project's target directory you'll able to see the generated jar file with the name "htmlunit-" followed by the version number.
mvn source:jar
This generates a source jar file.
mvn source:test-jar
This will generate a jar file of the test sources.
mvn org.apache.felix:maven-bundle-plugin:bundle
This will generate an OSGi bundle.
Forked Rhino (core-js)
You can get the source code from Maven central repository, while the repository resides in github.