Skip to content

Commit ecffe37

Browse files
Copilotvalfirst
andcommitted
Add parallel story execution examples to tests-configuration documentation
Co-authored-by: valfirst <5081226+valfirst@users.noreply.github.com>
1 parent b0fda06 commit ecffe37

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

docs/modules/configuration/pages/tests-configuration.adoc

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,47 @@ e.g., `0`, `#`, specify the way indices are displayed.
163163
|Paths to the composite steps e.g. `steps/*.steps`
164164
|===
165165

166+
==== Parallel Story Execution
167+
168+
Stories within a batch are executed in parallel using the number of threads specified by the `batch-<batch-number>.threads` property. By default, stories run sequentially (1 thread). Increasing the thread count can significantly reduce test execution time.
169+
170+
.suite.properties: Running stories in 2 batches with different parallelism levels
171+
[source,properties]
172+
----
173+
batch-1.resource-location=story/api
174+
batch-1.threads=5
175+
batch-1.name=API Tests
176+
177+
batch-2.resource-location=story/ui
178+
batch-2.threads=2
179+
batch-2.name=UI Tests
180+
----
181+
182+
In this example:
183+
184+
* `batch-1` runs API test stories from the `story/api` folder using `5` parallel threads. Since API tests are generally stateless, a higher level of parallelism can be used.
185+
* `batch-2` runs UI test stories from the `story/ui` folder using `2` parallel threads. UI tests may require more resources per thread, so a lower parallelism level is configured.
186+
* `batch-1` runs first, and only after it completes, `batch-2` starts (batches always run sequentially).
187+
188+
[IMPORTANT]
189+
====
190+
When running stories in parallel, make sure:
191+
192+
* Stories do not depend on each other's state or execution order.
193+
* Shared resources (e.g. database records, user sessions) are properly isolated across threads.
194+
* The `story` xref:commons:variables.adoc[variable scope] is thread-safe, but the `next_batches` and `global` scopes are shared.
195+
====
196+
197+
.suite.properties: Running all stories from a single folder with 3 threads
198+
[source,properties]
199+
----
200+
batch-1.resource-location=story/regression
201+
batch-1.threads=3
202+
batch-1.story.execution-timeout=PT30M
203+
----
204+
205+
The `story.execution-timeout` property limits how long each individual story can run. This is useful in parallel execution to prevent a single slow story from blocking a thread indefinitely.
206+
166207
=== Profiles
167208

168209
A profile defines the subject of the test, i.e. it answers the question "What are specifics of the browser/device I want to run tests on?".

0 commit comments

Comments
 (0)