Browse Source

Fix cross-reference links in HtmlUnit sections

Closes gh-35853

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>

(cherry picked from commit 91d2a51f3f)
pull/35859/head
Tran Ngoc Nhan 4 weeks ago committed by Sam Brannen
parent
commit
ff62e7355f
  1. 6
      framework-docs/modules/ROOT/pages/testing/mockmvc/htmlunit/geb.adoc
  2. 6
      framework-docs/modules/ROOT/pages/testing/mockmvc/htmlunit/mah.adoc
  3. 7
      framework-docs/modules/ROOT/pages/testing/mockmvc/htmlunit/webdriver.adoc

6
framework-docs/modules/ROOT/pages/testing/mockmvc/htmlunit/geb.adoc

@ -8,7 +8,7 @@ use https://www.gebish.org/[Geb] to make our tests even Groovy-er.
== Why Geb and MockMvc? == Why Geb and MockMvc?
Geb is backed by WebDriver, so it offers many of the Geb is backed by WebDriver, so it offers many of the
xref:testing/mockmvc/htmlunit/webdriver.adoc#spring-mvc-test-server-htmlunit-webdriver-why[same benefits] that we get from xref:testing/mockmvc/htmlunit/webdriver.adoc#mockmvc-server-htmlunit-webdriver-why[same benefits] that we get from
WebDriver. However, Geb makes things even easier by taking care of some of the WebDriver. However, Geb makes things even easier by taking care of some of the
boilerplate code for us. boilerplate code for us.
@ -28,7 +28,7 @@ def setup() {
---- ----
NOTE: This is a simple example of using `MockMvcHtmlUnitDriverBuilder`. For more advanced NOTE: This is a simple example of using `MockMvcHtmlUnitDriverBuilder`. For more advanced
usage, see xref:testing/mockmvc/htmlunit/webdriver.adoc#spring-mvc-test-server-htmlunit-webdriver-advanced-builder[Advanced `MockMvcHtmlUnitDriverBuilder`]. usage, see xref:testing/mockmvc/htmlunit/webdriver.adoc#mockmvc-server-htmlunit-webdriver-advanced-builder[Advanced `MockMvcHtmlUnitDriverBuilder`].
This ensures that any URL referencing `localhost` as the server is directed to our This ensures that any URL referencing `localhost` as the server is directed to our
`MockMvc` instance without the need for a real HTTP connection. Any other URL is `MockMvc` instance without the need for a real HTTP connection. Any other URL is
@ -62,7 +62,7 @@ forwarded to the current page object. This removes a lot of the boilerplate code
needed when using WebDriver directly. needed when using WebDriver directly.
As with direct WebDriver usage, this improves on the design of our As with direct WebDriver usage, this improves on the design of our
xref:testing/mockmvc/htmlunit/mah.adoc#spring-mvc-test-server-htmlunit-mah-usage[HtmlUnit test] by using the Page Object xref:testing/mockmvc/htmlunit/mah.adoc#mockmvc-server-htmlunit-mah-usage[HtmlUnit test] by using the Page Object
Pattern. As mentioned previously, we can use the Page Object Pattern with HtmlUnit and Pattern. As mentioned previously, we can use the Page Object Pattern with HtmlUnit and
WebDriver, but it is even easier with Geb. Consider our new Groovy-based WebDriver, but it is even easier with Geb. Consider our new Groovy-based
`CreateMessagePage` implementation: `CreateMessagePage` implementation:

6
framework-docs/modules/ROOT/pages/testing/mockmvc/htmlunit/mah.adoc

@ -45,7 +45,7 @@ Kotlin::
====== ======
NOTE: This is a simple example of using `MockMvcWebClientBuilder`. For advanced usage, NOTE: This is a simple example of using `MockMvcWebClientBuilder`. For advanced usage,
see xref:testing/mockmvc/htmlunit/mah.adoc#spring-mvc-test-server-htmlunit-mah-advanced-builder[Advanced `MockMvcWebClientBuilder`]. see <<mockmvc-server-htmlunit-mah-advanced-builder>>.
This ensures that any URL that references `localhost` as the server is directed to our This ensures that any URL that references `localhost` as the server is directed to our
`MockMvc` instance without the need for a real HTTP connection. Any other URL is `MockMvc` instance without the need for a real HTTP connection. Any other URL is
@ -77,7 +77,7 @@ Kotlin::
====== ======
NOTE: The default context path is `""`. Alternatively, we can specify the context path, NOTE: The default context path is `""`. Alternatively, we can specify the context path,
as described in xref:testing/mockmvc/htmlunit/mah.adoc#spring-mvc-test-server-htmlunit-mah-advanced-builder[Advanced `MockMvcWebClientBuilder`]. as described in <<mockmvc-server-htmlunit-mah-advanced-builder>>.
Once we have a reference to the `HtmlPage`, we can then fill out the form and submit it Once we have a reference to the `HtmlPage`, we can then fill out the form and submit it
to create a message, as the following example shows: to create a message, as the following example shows:
@ -144,7 +144,7 @@ Kotlin::
====== ======
The preceding code improves on our The preceding code improves on our
xref:testing/mockmvc/htmlunit/why.adoc#spring-mvc-test-server-htmlunit-mock-mvc-test[MockMvc test] in a number of ways. xref:testing/mockmvc/htmlunit/why.adoc#mockmvc-server-htmlunit-mock-mvc-test[MockMvc test] in a number of ways.
First, we no longer have to explicitly verify our form and then create a request that First, we no longer have to explicitly verify our form and then create a request that
looks like the form. Instead, we request the form, fill it out, and submit it, thereby looks like the form. Instead, we request the form, fill it out, and submit it, thereby
significantly reducing the overhead. significantly reducing the overhead.

7
framework-docs/modules/ROOT/pages/testing/mockmvc/htmlunit/webdriver.adoc

@ -203,7 +203,7 @@ Kotlin::
====== ======
NOTE: This is a simple example of using `MockMvcHtmlUnitDriverBuilder`. For more advanced NOTE: This is a simple example of using `MockMvcHtmlUnitDriverBuilder`. For more advanced
usage, see xref:testing/mockmvc/htmlunit/webdriver.adoc#spring-mvc-test-server-htmlunit-webdriver-advanced-builder[Advanced `MockMvcHtmlUnitDriverBuilder`]. usage, see <<mockmvc-server-htmlunit-webdriver-advanced-builder>>.
The preceding example ensures that any URL that references `localhost` as the server is The preceding example ensures that any URL that references `localhost` as the server is
directed to our `MockMvc` instance without the need for a real HTTP connection. Any other directed to our `MockMvc` instance without the need for a real HTTP connection. Any other
@ -259,9 +259,8 @@ Kotlin::
====== ======
-- --
This improves on the design of our xref:testing/mockmvc/htmlunit/mah.adoc#spring-mvc-test-server-htmlunit-mah-usage[HtmlUnit test] This improves on the design of our xref:testing/mockmvc/htmlunit/mah.adoc#mockmvc-server-htmlunit-mah-usage[HtmlUnit test]
by leveraging the Page Object Pattern. As we mentioned in by leveraging the Page Object Pattern. As we mentioned in <<mockmvc-server-htmlunit-webdriver-why>>, we can use the Page Object Pattern
xref:testing/mockmvc/htmlunit/webdriver.adoc#mockmvc-server-htmlunit-webdriver-why[Why WebDriver and MockMvc?], we can use the Page Object Pattern
with HtmlUnit, but it is much easier with WebDriver. Consider the following with HtmlUnit, but it is much easier with WebDriver. Consider the following
`CreateMessagePage` implementation: `CreateMessagePage` implementation:

Loading…
Cancel
Save