You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/ROOT/pages/munit-extensions-maven-plugin-configuration.adoc
+40-53Lines changed: 40 additions & 53 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,24 +44,22 @@ To enable runtime discovery, add the following configuration to the MUnit Extens
44
44
...
45
45
<runtimeConfiguration>
46
46
<discoverRuntimes>
47
-
<product>CE</product> //<1>
47
+
<product>`Product`</product> //<1>
48
48
</discoverRuntimes>
49
49
</runtimeConfiguration>
50
50
...
51
51
</configuration>
52
52
</plugin>
53
53
</plugins>
54
54
----
55
-
[calloutlist]
56
-
.. This enables the runtime discovery feature for all released CE runtimes.
57
55
58
-
From the command line, the property is `discoverRuntimes.product`.
56
+
The `Product` can be CE (Community Edition), EE (Enterprise Edition), or ALL (both CE and EE). For example, if the `Product` is CE, the runtime discovery feature is enabled for all released CE runtimes.
59
57
60
-
NOTE: The `product` can be CE (Community Edition), EE (Enterprise Edition), or ALL (both CE and EE).
58
+
From the command line, use the `discoverRuntimes.product` property to enable runtime discovery.
61
59
62
60
=== Include Snapshots
63
61
64
-
To include snapshot versions of Mule runtime, add the following line to the runtime configuration:
62
+
To include snapshot versions of Mule runtime, add an `includeSnapshots` property to the runtime configuration:
65
63
66
64
[source,xml,linenums]
67
65
----
@@ -73,11 +71,11 @@ To include snapshot versions of Mule runtime, add the following line to the runt
73
71
</runtimeConfiguration>
74
72
----
75
73
76
-
From the command line, the property is `discoverRuntimes.includeSnapshots`. The default value is `false`.
74
+
From the command line, use the `discoverRuntimes.includeSnapshots` property to include snapshots. The default value is `false`.
77
75
78
76
=== Discover Only the Latest Patches
79
77
80
-
To discover only the latest patch versions of Mule runtime, add the following line to the runtime configuration:
78
+
To discover only the latest patch versions of Mule runtime, add a `latestPatches` property to the runtime configuration:
81
79
82
80
[source,xml,linenums]
83
81
----
@@ -89,11 +87,11 @@ To discover only the latest patch versions of Mule runtime, add the following li
89
87
</runtimeConfiguration>
90
88
----
91
89
92
-
From the command line, the property is `discoverRuntimes.latestPatches`. The default value is `true`.
90
+
From the command line, use the `discoverRuntimes.latestPatches` property to discover only the latest patches. The default value is `true`.
93
91
94
92
=== Discover Since a Minimum Version
95
93
96
-
By default, runtime discovery searches for all Mule runtime versions since the `minMuleVersion` of the module. To change this minimum version, add the following line to the runtime configuration:
94
+
By default, runtime discovery searches for all Mule runtime versions since the `minMuleVersion` of the module. To change the minimum version, add a `minMuleVersion` property to the runtime configuration:
97
95
98
96
[source,xml,linenums]
99
97
----
@@ -105,11 +103,11 @@ By default, runtime discovery searches for all Mule runtime versions since the `
105
103
</runtimeConfiguration>
106
104
----
107
105
108
-
From the command line, the property is `discoverRuntimes.minMuleVersion`. The default value is the `minMuleVersion` of the module.
106
+
From the command line, use the `discoverRuntimes.minMuleVersion` property to discover runtimes since a minimum version. The default value is the `minMuleVersion` of the module.
109
107
110
108
=== Run Against Additional Runtimes
111
109
112
-
By default, the MUnit Extensions Maven plugin runs against the `minMuleVersion` and the required product of the module. To specify additional runtimes to run against, add the following lines to the runtime configuration:
110
+
By default, the MUnit Extensions Maven plugin runs against the `minMuleVersion` and the required product of the module. To specify additional runtimes to run against, add `additionalRuntime` properties to the runtime configuration:
113
111
114
112
[source,xml,linenums]
115
113
----
@@ -121,11 +119,11 @@ By default, the MUnit Extensions Maven plugin runs against the `minMuleVersion`
121
119
</runtimeConfiguration>
122
120
----
123
121
124
-
From the command line, the property is `additionalRuntimes`.
122
+
From the command line, use the `additionalRuntimes` property to run against additional runtimes.
125
123
126
124
=== Skip Runtime Discovery
127
125
128
-
To skip runtime discovery, add the following line to the runtime configuration:
126
+
To skip runtime discovery, add a `skip` property to the runtime configuration:
129
127
130
128
[source,xml,linenums]
131
129
----
@@ -137,28 +135,24 @@ To skip runtime discovery, add the following line to the runtime configuration:
137
135
</runtimeConfiguration>
138
136
----
139
137
140
-
From the command line, the property is `discoverRuntimes.skip`. The default value is `false`.
138
+
From the command line, use the `discoverRuntimes.skip` property to skip runtime discovery. The default value is `false`.
141
139
142
140
== Use Dynamic Ports
143
141
144
142
[IMPORTANT]
145
143
MUnit 2.2 and later introduces the `dynamic-port` global element, which you can use to define dynamic ports at the MUnit suite level. +
146
-
Use this element instead of the plugin configuration described below to set the dynamic port both from Maven and Studio. +
144
+
Use this element instead of the plugin configuration described below to set the dynamic port from both Maven and Studio. +
147
145
For more information about how to configure this element, refer to xref:munit::dynamic-ports.adoc[Dynamic Ports].
148
146
149
147
When testing a module in a continuous integration (CI) environment, you might encounter the following scenario:
150
148
151
149
`Your test tries to open a specific port. The port is already in use. The test fails with a port binding exception.`
152
150
153
-
To solve this, use the dynamic ports built-in feature in the MUnit Extensions Maven plugin to have your test use a free port. Dynamic ports instruct the MUnit Extensions Maven plugin to look for unbound ports and reserves them before running the tests over the module. Each port selected is placed in a system property under the name indicated in the configuration. The test can acquire the port number through the use of placeholders afterward.
151
+
To solve this, use the dynamic ports built-in feature in the MUnit Extensions Maven plugin to have your test use a free port. Dynamic ports instruct the MUnit Extensions Maven plugin to look for unbound ports and reserves them before running the tests over the module. Each selected port is placed in a system property under the name indicated in the configuration. The test can acquire the port number through the use of placeholders afterward.
154
152
155
-
TIP: The ports to select by the MUnit Extensions Maven plugin are taken from the following range: `[40000,50000)`.
153
+
The ports that the MUnit Extensions Maven plugin can select are in the following range: `[40000,50000)`.
156
154
157
-
[CAUTION]
158
-
--
159
-
The dynamic ports feature is available only as part of the MUnit Extensions Maven Plugin. +
160
-
You can't expect this feature to work when running tests from inside Anypoint Studio.
161
-
--
155
+
The dynamic ports feature is available only as part of the MUnit Extensions Maven plugin. This feature doesn't work when running tests from inside Anypoint Studio.
162
156
163
157
=== Enable Dynamic Ports
164
158
@@ -192,20 +186,20 @@ If you have the `${http.port}` placeholder in your test, the configuration looks
192
186
193
187
== Disable Surefire Reports
194
188
195
-
MUnit has built-in support for Surefire. No additional configuration is needed but it can be disabled if not needed.
189
+
MUnit has built-in support for Surefire. You can disable this support if it's not needed.
The reports can be found under `${project.build.directory}/surefire-reports`.
196
+
The reports are located under `${project.build.directory}/surefire-reports`.
203
197
204
198
The default value is `true`.
205
199
206
200
== Run Specific Tests
207
201
208
-
To run specific tests, add a line for the specific test:
202
+
To run a specific test, add an `munitTest` property for each specific test to the configuration section of the MUnit Extensions Maven plugin:
209
203
210
204
[source,xml,linenums]
211
205
----
@@ -224,7 +218,7 @@ To run specific tests, add a line for the specific test:
224
218
225
219
== Run Tests with Specific Tags
226
220
227
-
To run tests with specific tags, add a line for the test with the specific tag:
221
+
To run tests with specific tags, add an `munitTags` property for the test with the specific tag to the configuration section of the MUnit Extensions Maven plugin. Separate the tags with commas:
228
222
229
223
[source,xml,linenums]
230
224
----
@@ -234,18 +228,16 @@ To run tests with specific tags, add a line for the test with the specific tag:
You can specify more than one tag by separating them with a comma.
245
-
246
238
== Skip MUnit Tests
247
239
248
-
To skip MUnit tests, add a line to skip MUnit tests:
240
+
To skip MUnit tests, add a `skipMunitTests` property to skip MUnit tests to the configuration section of the MUnit Extensions Maven plugin:
249
241
250
242
[source,xml,linenums]
251
243
----
@@ -264,7 +256,7 @@ To skip MUnit tests, add a line to skip MUnit tests:
264
256
265
257
== Skip Tests After One Suite Fails
266
258
267
-
To skip the rest of the tests if one test suite fails, add a line to skip after failure:
259
+
To skip the rest of the tests if one test suite fails, add a `skipAfterFailure` property to skip after failure to the configuration section of the MUnit Extensions Maven plugin:
268
260
269
261
[source,xml,linenums]
270
262
----
@@ -285,7 +277,7 @@ The default value is `false`.
285
277
286
278
== Specify the Mule Runtime Version
287
279
288
-
To specify the Mule runtime version that your tested module runs on, add a line for the Mule runtime version:
280
+
To specify the Mule runtime version that your tested module runs on, add a `runtimeVersion` property for the Mule runtime version to the configuration section of the MUnit Extensions Maven plugin:
289
281
290
282
[source,xml,linenums]
291
283
----
@@ -302,13 +294,13 @@ To specify the Mule runtime version that your tested module runs on, add a line
302
294
</plugins>
303
295
----
304
296
305
-
WARNING: If this option is set, runtime discovery and `additionalRuntimes` don't take effect.
297
+
If this option is set, runtime discovery and `additionalRuntimes` don't take effect.
306
298
307
299
== Specify the Runtime Product
308
300
309
301
You can specify the type of runtime that your tested module runs on.
310
302
311
-
The two possible values are `MULE` for Community Edition, and `MULE_EE` for Enterprise Edition.
303
+
Values are `MULE` for Community Edition, and `MULE_EE` for Enterprise Edition.
312
304
313
305
[source,xml,linenums]
314
306
----
@@ -325,11 +317,11 @@ The two possible values are `MULE` for Community Edition, and `MULE_EE` for Ente
325
317
</plugins>
326
318
----
327
319
328
-
WARNING: If this option is set, runtime discovery and `additionalRuntimes` don't take effect.
320
+
If this option is set, runtime discovery and `additionalRuntimes` don't take effect.
329
321
330
322
== Specify the JVM
331
323
332
-
You can specify the JVM (or the Java executable) that your tested module runs on. Populate the property with the path to the executable.
324
+
To specify the JVM (Java executable) that your tested module runs on, populate the `jvm` property with the path to the executable:
333
325
334
326
[source,xml,linenums]
335
327
----
@@ -346,7 +338,7 @@ You can specify the JVM (or the Java executable) that your tested module runs on
346
338
</plugins>
347
339
----
348
340
349
-
From the command line, the property is `-Dmunit.jvm`.
341
+
From the command line, use the `-Dmunit.jvm` property to specify the JVM.
350
342
351
343
== Set Environment Variables
352
344
@@ -370,11 +362,11 @@ To set additional environment variables during the test run, specify them with t
370
362
</plugins>
371
363
----
372
364
373
-
Use environment variables to replace placeholders such as `${MY_ENV}` (from the example above).
365
+
Use environment variables to replace `${MY_ENV}` and `${MY_OTHER_ENV}`.
374
366
375
367
== Redirect Test Output to a File
376
368
377
-
When running several tests, the build output can be complicated to read. You can redirect the build output of each test suite to a file so the build output contains the test results and the respective file contains standard output of each test suite.
369
+
When running several tests, the build output can be complicated to read. You can redirect the build output of each test suite to a file so that the build output contains the test results and the respective file contains the standard output of each test suite.
378
370
379
371
These files are located in the `testOutputDirectory` folder and follow the `munit.${suiteName}-output.txt` naming convention, in which `suiteName` is the name of the XML file relative to the MUnit test folder.
380
372
@@ -418,24 +410,18 @@ You can define specific system variables needed for your MUnit test to run succe
418
410
</plugins>
419
411
----
420
412
421
-
[TIP]
422
-
====
423
413
Depending on the execution context, the system properties values might vary. When referencing these properties, override their value to enforce test reproducibility.
424
414
425
415
You can do so by using the `-D` argument when running MUnit with Maven. +
426
-
Variables passed with the `-D` argument take full priority over any other property.
427
-
428
-
For example:
429
-
430
-
`-Dmy.property.key=my.property.another.value`
431
-
====
416
+
Variables passed with the `-D` argument take full priority over any other property, for example, `-Dmy.property.key=my.property.another.value`.
432
417
433
418
== Test Output Directory
434
419
435
420
You can choose the location where the test output files are created.
436
421
The specified path can be an absolute path or a Maven placeholder.
437
422
438
-
.Test output directory with an absolute path
423
+
If the specified path is an absolute path, the test output directory looks like this:
424
+
439
425
[source,xml,linenums]
440
426
----
441
427
<plugins>
@@ -451,7 +437,8 @@ The specified path can be an absolute path or a Maven placeholder.
451
437
</plugins>
452
438
----
453
439
454
-
.Test output directory with a Maven placeholder
440
+
If the specified path is a Maven placeholder, the test output directory looks like this:
@@ -462,7 +449,7 @@ By default, the files are created in `${project.build.directory}/munit-reports/o
462
449
== Specify Shared Libraries
463
450
464
451
When requiring external libraries (as explained in xref:external-libs.adoc[]), specify
465
-
these libraries as `sharedLibraries` (apart from having the corresponding dependencies in the project).
452
+
these libraries as `sharedLibraries`. You must also have the corresponding dependencies in the project.
466
453
467
454
For example, if you define the following external library in your module:
468
455
@@ -497,7 +484,7 @@ You must configure the plugin in the following way:
497
484
498
485
== Import External Suites and Resources
499
486
500
-
To reuse suite files that are present in an external artifact across different modules, include the suite files in the configuration as if they are present in the `src/test/munit` and `src/test/resources` folders. Ensure you add the dependencies in the plugin's classpath.
487
+
To reuse suite files that are present in an external artifact across different modules, include the suite files in the configuration as if they are present in the `src/test/munit` and `src/test/resources` folders. Ensure that you add the dependencies in the plugin's classpath.
501
488
502
489
[source,xml,linenums]
503
490
----
@@ -527,7 +514,7 @@ To reuse suite files that are present in an external artifact across different m
527
514
</plugins>
528
515
----
529
516
530
-
If any of the suite files or resources are not present in the classpath, the plugin fails.
517
+
If any of the suite files or resources aren't present in the classpath, the plugin fails.
0 commit comments