Skip to content

Commit

Permalink
Polish User Guide
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Dec 10, 2018
1 parent 37db93c commit 822d0fc
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions documentation/src/docs/asciidoc/user-guide/writing-tests.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1420,10 +1420,10 @@ version 5.3. To enable parallel execution, set the
example, in `junit-platform.properties` (see <<running-tests-config-params>> for other
options).

Enabling this property is but the first step to execute tests in parallel. If enabled,
test classes and methods are still executed sequentially by default. Whether or not a node
in the test tree is executed concurrently is controlled by its execution mode. The
following two modes are available:
Please note that enabling this property is only the first step required to execute tests
in parallel. If enabled, test classes and methods will still be executed sequentially by
default. Whether or not a node in the test tree is executed concurrently is controlled by
its execution mode. The following two modes are available.

`SAME_THREAD`::
Force execution in the same thread used by the parent. For example, when used on a test
Expand All @@ -1435,9 +1435,9 @@ following two modes are available:

By default, nodes in the test tree use the `SAME_THREAD` execution mode. You can change
the default by setting the `junit.jupiter.execution.parallel.mode.default` configuration
parameter. Alternatively, you can use the `{Execution}` annotation to change the execution
mode for the annotated element and its subelements (if any) which allows to activate
parallel execution for individual test classes, one by one.
parameter. Alternatively, you can use the `{Execution}` annotation to change the
execution mode for the annotated element and its subelements (if any) which allows you to
activate parallel execution for individual test classes, one by one.

[source,properties]
.Configuration parameters to execute all tests in parallel
Expand All @@ -1448,17 +1448,18 @@ junit.jupiter.execution.parallel.mode.default = concurrent

The default execution mode is applied to all nodes of the test tree with a few notable
exceptions, namely test classes that use the `Lifecycle.PER_CLASS` mode or a
`{MethodOrderer}` (except for `{Random}`). In the former case, test authors have to ensure
that the test class is thread-safe; in the latter, concurrent execution might conflict
with the configured execution order. Thus, in both cases, test methods in such test
classes are only executed concurrently if the `@Execution(CONCURRENT)` annotation is
`{MethodOrderer}` (except for `{Random}`). In the former case, test authors have to
ensure that the test class is thread-safe; in the latter, concurrent execution might
conflict with the configured execution order. Thus, in both cases, test methods in such
test classes are only executed concurrently if the `@Execution(CONCURRENT)` annotation is

This comment has been minimized.

Copy link
@marcphilipp

marcphilipp Dec 10, 2018

Member

@sbrannen I thought we agreed to break lines after 90 characters, not 89. 🤔

This comment has been minimized.

Copy link
@sbrannen

sbrannen Dec 10, 2018

Author Member

Indeed we did agree on 90.

It would appear that my text editor (TextMate version 2.0-rc.10) wraps it like that when set to wrap at 90 characters.

I guess I should change it to 91 characters. Odd..... sorry!

This comment has been minimized.

Copy link
@sbrannen

sbrannen Dec 10, 2018

Author Member

Another off-by-one 🐛

This comment has been minimized.

Copy link
@marcphilipp

marcphilipp Dec 11, 2018

Member

No worries, I was just a little confused. 😉

present on the test class or method.

All nodes of the test tree that with execution mode `CONCURRENT` will be executed fully in
parallel according to the provided <<writing-tests-parallel-execution-config,
configuration>> while observing the declarative
<<writing-tests-parallel-execution-synchronization, synchronization>> mechanism. Please
note that <<running-tests-capturing-output>> needs to be enabled separately.
All nodes of the test tree that are configured with the `CONCURRENT` execution mode will
be executed fully in parallel according to the provided
<<writing-tests-parallel-execution-config, configuration>> while observing the
declarative <<writing-tests-parallel-execution-synchronization, synchronization>>
mechanism. Please note that <<running-tests-capturing-output>> needs to be enabled
separately.

[[writing-tests-parallel-execution-config]]
==== Configuration
Expand All @@ -1469,7 +1470,7 @@ implementations out of the box: `dynamic` and `fixed`. Alternatively, you may im
`custom` strategy.

To select a strategy, set the `junit.jupiter.execution.parallel.config.strategy`
configuration parameter to one of the following options:
configuration parameter to one of the following options.

`dynamic`::
Computes the desired parallelism based on the number of available processors/cores
Expand Down Expand Up @@ -1506,7 +1507,7 @@ Jupiter provides another annotation-based declarative synchronization mechanism.
specific shared resource that requires synchronized access to ensure reliable test
execution. The shared resource is identified by a unique name which is a `String`. The
name can be user-defined or one of the predefined constants in `{Resources}`:
`SYSTEM_PROPERTIES`, `SYSTEM_OUT`, or `SYSTEM_ERR`.
`SYSTEM_PROPERTIES`, `SYSTEM_OUT`, `SYSTEM_ERR`, `LOCALE`, or `TIME_ZONE`.

If the tests in the following example were run in parallel _without_ the use of
{ResourceLock}, they would be _flaky_. Sometimes they would pass, and at other times they
Expand Down

0 comments on commit 822d0fc

Please sign in to comment.