File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -301,6 +301,37 @@ defmodule ExUnit.Case do
301
301
302
302
As with other tags, `:tmp_dir` can also be set as `@moduletag` and
303
303
`@describetag`.
304
+
305
+ ## Process Architecture
306
+
307
+ An ExUnit test case uses several processes when it runs. These are illustrated below.
308
+
309
+ ```mermaid
310
+ sequenceDiagram
311
+ participant runner as ExUnit Case
312
+ runner->>runner: Run setup_all callbacks
313
+
314
+ loop Each test
315
+ create participant test as Test Process
316
+ runner->>test: Spawn
317
+ test->>test: Run setup callbacks
318
+ test->>test: Run test
319
+ destroy test
320
+ test-xrunner: Exits
321
+ runner->>runner: Run on_exit callbacks
322
+ end
323
+ ```
324
+
325
+ 1. First, all `ExUnit.Callbacks.setup_all/1` callbacks run in a single process, sequentially,
326
+ in the order they were defined.
327
+
328
+ 2. Then, a new process is spawned for the test itself. In this process, first all
329
+ `ExUnit.Callbacks.setup/1` callbacks run, in the order they were defined. Then,
330
+ the test itself is executed.
331
+
332
+ 3. After the test exits, a new process is spawned to run all `ExUnit.Callbacks.on_exit/2`,
333
+ in the reverse order they were defined.
334
+
304
335
"""
305
336
306
337
@ type env :: module ( ) | Macro.Env . t ( )
You can’t perform that action at this time.
0 commit comments