1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <document >
3
+
4
+ <properties >
5
+ <title >HtmlUnit Development</title >
6
+ <
author email =
" [email protected] " >Ronald Brill</
author >
7
+ </properties >
8
+
9
+ <body >
10
+ <section name =" Content" id =" content" >
11
+ <macro name =" toc" >
12
+ <param name =" section" value =" 2" />
13
+ <param name =" fromDepth" value =" 0" />
14
+ <param name =" toDepth" value =" 4" />
15
+ </macro >
16
+ </section >
17
+
18
+ <section name =" HtmlUnit Development" >
19
+ <subsection name =" Prerequisites" >
20
+ <p >Before starting, ensure you have the following installed:</p >
21
+ <ul >
22
+ <li ><strong >Java Development Kit (JDK 11)</strong > HtmlUnit is JDK 8 but for running the untit test JDK 11 is required</li >
23
+ <li ><strong >Eclipse IDE</strong ></li >
24
+ <li ><strong >Maven 3</strong ></li >
25
+ <li ><strong >Git</strong > use your favorite git client</li >
26
+ <li ><strong >Web Browser</strong >Chrome / Firefox / Edge to check the compatibility</li >
27
+ </ul >
28
+ </subsection >
29
+
30
+ <subsection name =" Repository Setup and first build" >
31
+ <h4 >Clone the HtmlUnit repository from GitHub</h4 >
32
+ <source >
33
+ git clone https://github.com/HtmlUnit/htmlunit.git
34
+ cd htmlunit
35
+ </source >
36
+
37
+ <h4 >Compile the project to ensure everything is working correctly</h4 >
38
+ <source >
39
+ mvn clean compile
40
+ </source >
41
+
42
+ <h4 >Run some unit tests</h4 >
43
+ <p >do not run the whole test suite because this takes really long</p >
44
+ <source >
45
+ mvn test -Dtest=org.htmlunit.javascript.host.dom.*Test
46
+ </source >
47
+ </subsection >
48
+
49
+ <subsection name =" Eclipse Project Setup" >
50
+ <h4 >Generate Eclipse project files</h4 >
51
+ <p >use the Maven Eclipse Plugin generate Eclipse project files with source downloads</p >
52
+ <source >
53
+ mvn eclipse:eclipse -DdownloadSources=true
54
+ </source >
55
+ <p >then import the Project in Eclipse</p >
56
+ <p ><code >File → Import → Existing Projects into Workspace</code ></p >
57
+
58
+ <h4 >Running Tests from Eclipse</h4 >
59
+ <p >Usually you would run only some test from Eclipse.</p >
60
+ <p >Please have a look at the section 'Running Test with real browsers' below for more options</p >
61
+ </subsection >
62
+
63
+ <subsection name =" IntelliJ IDEA Project" >
64
+ ToDo
65
+ </subsection >
66
+
67
+ <subsection name =" Running the Tests from Maven" >
68
+ <p >Run of the full Test Suite requires significant time (several hours) and resources.
69
+ Therfore some profiles are defined to run different parts of the test suite. These
70
+ profiels are also used by the various jenkins jobs.</p >
71
+
72
+ <h4 >Run Core test suite</h4 >
73
+ <p >Run core tests only (faster (~25min), excludes library and huge tests)</p >
74
+ <source >
75
+ mvn test -P without-library-and-huge-tests -Dgpg.skip -Djava.awt.headless=true
76
+ </source >
77
+
78
+ <h4 >Run Library test suite</h4 >
79
+ <p >Run the test suites from various js libraries (jQuery, prototype, etc.)</p >
80
+ <source >
81
+ mvn test -P only-library-tests -Dgpg.skip -Djava.awt.headless=true
82
+ </source >
83
+
84
+ <h4 >Ports used</h4 >
85
+ <h5 >Test Port Configuration</h5 >
86
+ <p >
87
+ Tests currently assume that port 12345 is free on the machine. If you encounter
88
+ <code >java.net.BindException: Address already in use: JVM_Bind</code >, set the
89
+ system property <code >htmlunit.test.port</code >:
90
+ </p >
91
+ <source >
92
+ mvn test ... -Dhtmlunit.test.port=10101
93
+ </source >
94
+ </subsection >
95
+
96
+ <subsection name =" Running Test with real browsers" >
97
+ <p >The aim of the development of HtmlUnit is to provide as accurate a simulation of the various browsers as possible.
98
+ As browsers are constantly evolving, we have to adapt our test assumptions with every update. Therefore (almost)
99
+ all tests are implemented in such a way that they can be executed with HtmlUnit as well
100
+ as (with the help of Selenium WebDriver) with the supported real browsers.</p >
101
+
102
+ <p >This behavior is provided by the superclass org.htmlunit.WebDriverTestCase. The test execution can be
103
+ switched accordingly with the help of a configuration file.</p >
104
+
105
+ <p >By default, all tests runing with HtmlUnit, but this behavior can be changed by having a property file named
106
+ "{@code test.properties}" in the HtmlUnit root directory.</p >
107
+
108
+ <p >Sample (remove the part not matching your os)</p >
109
+ <source >
110
+ browsers=hu
111
+ #browsers=hu-ff
112
+ #browsers=hu-ff, hu-chrome
113
+ #browsers=ff, chrome, edge
114
+
115
+ ff.bin=/usr/bin/firefox [Unix]
116
+ ff-esr.bin=/usr/bin/firefox-esr [Unix]
117
+ geckodriver.bin=/usr/bin/driver/geckodriver [Unix]
118
+ chrome.bin=/path/to/chromedriver [Unix]
119
+ edge.bin=/path/to/chromedriver [Unix]
120
+
121
+ geckodriver.bin=C:\\path\\to\\geckodriver.exe [Windows]
122
+ ff.bin=C:\\path\\to\\Mozilla Firefox\\firefox.exe [Windows]
123
+ ff-esr.bin=C:\\path\\to\\Mozilla Firefox ESR\\firefox.exe [Windows]
124
+ chrome.bin=C:\\path\\to\\chromedriver.exe [Windows]
125
+ edge.bin=C:\\path\\to\\msedgedriver.exe [Windows]
126
+
127
+ autofix=false
128
+ </source >
129
+ <p >The file could contain some properties</p >
130
+ <ul >
131
+ <li >browsers: is a comma separated list contains any combination of
132
+ <ul >
133
+ <li >hu (for HtmlUnit with all browser versions),</li >
134
+ <li >hu-ff,</li >
135
+ <li >hu-ff-esr,</li >
136
+ <li >hu-chrome,</li >
137
+ <li >hu-edge,</li >
138
+ <li >ff, (running test using real Firefox),</li >
139
+ <li >ff-esr, (running test using real Firefox ESR),</li >
140
+ <li >chrome (running test using real Chrome),</li >
141
+ <li >edge (running test using real Edge),</li >
142
+ </ul >
143
+ </li >
144
+
145
+ <li >chrome.bin (mandatory if it does not exist in the <i >path</i >): is the location of the ChromeDriver binary (see
146
+ <a href =" https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json" >Chrome Driver downloads</a >)</li >
147
+ <li >geckodriver.bin (mandatory if it does not exist in the <i >path</i >): is the location of the GeckoDriver binary
148
+ (see <a href =" https://github.com/mozilla/geckodriver/releases" >Gecko Driver Releases</a >)</li >
149
+ <li >ff.bin (optional): is the location of the FF binary, in Windows use double back-slashes</li >
150
+ <li >ff-esr.bin (optional): is the location of the FF binary, in Windows use double back-slashes</li >
151
+ <li >edge.bin (mandatory if it does not exist in the <i >path</i >): is the location of the MicrosoftWebDriver binary
152
+ (see <a href =" https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/" >Microsoft Edge WebDriver downloads</a >)</li >
153
+ <li >autofix (optional): if {@code true}, try to automatically fix the real browser expectations,
154
+ or add/remove {@code @NotYetImplemented} annotations, use with caution!</li >
155
+ </ul >
156
+ </subsection >
157
+
158
+ </section >
159
+ </body >
160
+ </document >
0 commit comments