Upgrade to HtmUnit 3.11.0
This commit upgrades to a major new release of HtmlUnit. This is a breaking change as HtmlUnit 3 moves to a `org.htmlunit` package and calling code needs to be restructured. Our use of Selenium has been adapted accordingly, moving to Selenium 3, using the new org.seleniumhq.selenium:htmlunit3-driver integration. Closes gh-30392
This commit is contained in:
@@ -8,8 +8,7 @@ to use the raw HtmlUnit libraries.
|
||||
== MockMvc and HtmlUnit Setup
|
||||
|
||||
First, make sure that you have included a test dependency on
|
||||
`net.sourceforge.htmlunit:htmlunit`. In order to use HtmlUnit with Apache HttpComponents
|
||||
4.5+, you need to use HtmlUnit 2.18 or higher.
|
||||
`org.htmlunit:htmlunit`.
|
||||
|
||||
We can easily create an HtmlUnit `WebClient` that integrates with MockMvc by using the
|
||||
`MockMvcWebClientBuilder`, as follows:
|
||||
|
||||
@@ -166,7 +166,7 @@ following sections to make this pattern much easier to implement.
|
||||
== MockMvc and WebDriver Setup
|
||||
|
||||
To use Selenium WebDriver with the Spring MVC Test framework, make sure that your project
|
||||
includes a test dependency on `org.seleniumhq.selenium:selenium-htmlunit-driver`.
|
||||
includes a test dependency on `org.seleniumhq.selenium:selenium-htmlunit3-driver`.
|
||||
|
||||
We can easily create a Selenium WebDriver that integrates with MockMvc by using the
|
||||
`MockMvcHtmlUnitDriverBuilder` as the following example shows:
|
||||
|
||||
@@ -87,7 +87,7 @@ Kotlin::
|
||||
|
||||
This test has some obvious drawbacks. If we update our controller to use the parameter
|
||||
`message` instead of `text`, our form test continues to pass, even though the HTML form
|
||||
is out of synch with the controller. To resolve this we can combine our two tests, as
|
||||
is out of sync with the controller. To resolve this we can combine our two tests, as
|
||||
follows:
|
||||
|
||||
[tabs]
|
||||
|
||||
Reference in New Issue
Block a user