File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -301,6 +301,43 @@ defmodule ExUnit.Case do
301301
302302  As with other tags, `:tmp_dir` can also be set as `@moduletag` and 
303303  `@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+   flowchart TD 
311+     subgraph setup_alls [setup_all process] 
312+       setup_all(All setup_all callbacks) 
313+     end 
314+ 
315+     setup_alls --> tests 
316+ 
317+     subgraph tests [Test process] 
318+       setup(setup callbacks) 
319+       test(Test) 
320+ 
321+       setup --> test 
322+     end 
323+ 
324+     tests --> on_exits 
325+ 
326+     subgraph on_exits [on_exit process] 
327+       on_exit(on_exit callbacks, reverse order) 
328+     end 
329+   ``` 
330+ 
331+     1. First, all `ExUnit.Callbacks.setup_all/1` callbacks run in a single process, sequentially, 
332+        in the order they were defined. 
333+ 
334+     2. Then, a new process is spawned for the test itself. In this process, first all 
335+        `ExUnit.Callbacks.setup/1` callbacks run, in the order they were defined. Then, 
336+        the test itself is executed. 
337+ 
338+     3. After the test exits, a new process is spawned to run all `ExUnit.Callbacks.on_exit/2`, 
339+        in the reverse order they were defined. 
340+ 
304341  """ 
305342
306343  @ type  env  ::  module ( )  |  Macro.Env . t ( ) 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments