Skip to content

Commit e146e80

Browse files
committed
Polishing
(cherry picked from commit d178930)
1 parent ff62e73 commit e146e80

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use https://www.gebish.org/[Geb] to make our tests even Groovy-er.
88
== Why Geb and MockMvc?
99

1010
Geb is backed by WebDriver, so it offers many of the
11-
xref:testing/mockmvc/htmlunit/webdriver.adoc#mockmvc-server-htmlunit-webdriver-why[same benefits] that we get from
12-
WebDriver. However, Geb makes things even easier by taking care of some of the
13-
boilerplate code for us.
11+
xref:testing/mockmvc/htmlunit/webdriver.adoc#mockmvc-server-htmlunit-webdriver-why[same benefits]
12+
that we get from WebDriver. However, Geb makes things even easier by taking care of some
13+
of the boilerplate code for us.
1414

1515
[[mockmvc-server-htmlunit-geb-setup]]
1616
== MockMvc and Geb Setup
@@ -28,7 +28,8 @@ def setup() {
2828
----
2929

3030
NOTE: This is a simple example of using `MockMvcHtmlUnitDriverBuilder`. For more advanced
31-
usage, see xref:testing/mockmvc/htmlunit/webdriver.adoc#mockmvc-server-htmlunit-webdriver-advanced-builder[Advanced `MockMvcHtmlUnitDriverBuilder`].
31+
usage, see
32+
xref:testing/mockmvc/htmlunit/webdriver.adoc#mockmvc-server-htmlunit-webdriver-advanced-builder[Advanced `MockMvcHtmlUnitDriverBuilder`].
3233

3334
This ensures that any URL referencing `localhost` as the server is directed to our
3435
`MockMvc` instance without the need for a real HTTP connection. Any other URL is
@@ -62,10 +63,10 @@ forwarded to the current page object. This removes a lot of the boilerplate code
6263
needed when using WebDriver directly.
6364

6465
As with direct WebDriver usage, this improves on the design of our
65-
xref:testing/mockmvc/htmlunit/mah.adoc#mockmvc-server-htmlunit-mah-usage[HtmlUnit test] by using the Page Object
66-
Pattern. As mentioned previously, we can use the Page Object Pattern with HtmlUnit and
67-
WebDriver, but it is even easier with Geb. Consider our new Groovy-based
68-
`CreateMessagePage` implementation:
66+
xref:testing/mockmvc/htmlunit/mah.adoc#mockmvc-server-htmlunit-mah-usage[HtmlUnit test]
67+
by using the Page Object Pattern. As mentioned previously, we can use the Page Object
68+
Pattern with HtmlUnit and WebDriver, but it is even easier with Geb. Consider our new
69+
Groovy-based `CreateMessagePage` implementation:
6970

7071
[source,groovy]
7172
----

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ to use the raw HtmlUnit libraries.
77
[[mockmvc-server-htmlunit-mah-setup]]
88
== MockMvc and HtmlUnit Setup
99

10-
First, make sure that you have included a test dependency on
11-
`org.htmlunit:htmlunit`.
10+
First, make sure that you have included a test dependency on `org.htmlunit:htmlunit`.
1211

1312
We can easily create an HtmlUnit `WebClient` that integrates with MockMvc by using the
1413
`MockMvcWebClientBuilder`, as follows:

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,11 @@ Kotlin::
259259
======
260260
--
261261

262-
This improves on the design of our xref:testing/mockmvc/htmlunit/mah.adoc#mockmvc-server-htmlunit-mah-usage[HtmlUnit test]
263-
by leveraging the Page Object Pattern. As we mentioned in <<mockmvc-server-htmlunit-webdriver-why>>, we can use the Page Object Pattern
264-
with HtmlUnit, but it is much easier with WebDriver. Consider the following
262+
This improves on the design of our
263+
xref:testing/mockmvc/htmlunit/mah.adoc#mockmvc-server-htmlunit-mah-usage[HtmlUnit test]
264+
by leveraging the Page Object Pattern. As we mentioned in
265+
<<mockmvc-server-htmlunit-webdriver-why>>, we can use the Page Object Pattern with
266+
HtmlUnit, but it is much easier with WebDriver. Consider the following
265267
`CreateMessagePage` implementation:
266268

267269
--

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ assume our form looks like the following snippet:
6060
</form>
6161
----
6262

63-
How do we ensure that our form produce the correct request to create a new message? A
63+
How do we ensure that our form produces the correct request to create a new message? A
6464
naive attempt might resemble the following:
6565

6666
[tabs]
@@ -154,7 +154,7 @@ validation.
154154
[[mockmvc-server-htmlunit-why-integration]]
155155
== Integration Testing to the Rescue?
156156

157-
To resolve the issues mentioned earlier, we could perform end-to-end integration testing,
157+
To resolve the issues mentioned above, we could perform end-to-end integration testing,
158158
but this has some drawbacks. Consider testing the view that lets us page through the
159159
messages. We might need the following tests:
160160

@@ -171,7 +171,7 @@ leads to a number of additional challenges:
171171
* Testing can become slow, since each test would need to ensure that the database is in
172172
the correct state.
173173
* Since our database needs to be in a specific state, we cannot run tests in parallel.
174-
* Performing assertions on such items as auto-generated IDs, timestamps, and others can
174+
* Performing assertions on items such as auto-generated IDs, timestamps, and others can
175175
be difficult.
176176

177177
These challenges do not mean that we should abandon end-to-end integration testing

0 commit comments

Comments
 (0)