- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3.5k
Add Mermaid graph about ExUnit processes #14372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| Would a sequence diagram work better? http://mermaid.js.org/syntax/sequenceDiagram.html | 
| @josevalim maybe but I find it harder to read, while this looks really simple to me. I don't have a strong pref though :) | 
| sequenceDiagram
    Runner->>Runner: setup_all
    Runner->>Test Process #1: spawn
    Test Process #1->>Test Process #1: setup
    Test Process #1->>Test Process #1: run test
    Test Process #1->>Runner: exit
    Runner->>Runner: on_exit callbacks
Another one if you want to show multiple test processes: sequenceDiagram
    Runner->>Runner: setup_all
    Runner->>Test Process #1: spawn
    Test Process #1->>Test Process #1: setup
    Test Process #1->>Test Process #1: run test
    Test Process #1->>Runner: exit
    Runner->>Runner: on_exit callbacks
    %% You may remove this later half
    Runner->>Test Process #2: spawn
    Test Process #2->>Test Process #2: setup
    Test Process #2->>Test Process #2: run test
    Test Process #2->>Runner: exit
    Runner->>Runner: on_exit #2 callbacks
 | 
| Let me get my Mermaid fu out then. You're on | 
| @josevalim jokes aside, this is the best I can do: sequenceDiagram
    participant runner as ExUnit case runner
    loop Each setup_all callback
      runner->>runner: setup_all
      Note over runner: In the order they're defined
    end
    loop Each test
    create participant test1 as Test process 1
    runner->>test1: Spawn
    loop Each setup callback
      test1->>test1: setup
      Note over test1: In the order they're defined
    end
    test1->>test1: Run test
    destroy test1
    test1-xrunner: Test exits
    loop Each on_exit
        runner->>runner: on_exit
        Note over runner: In the reverse order they're defined
    end
    end
It's very precise IMO, but I’m not sure it's legible. I'll let you choose between my first option, your (second option), and this third option. | 
| I like the loop! Here is a proposal between mine and yours: sequenceDiagram
    participant runner as ExUnit Case
    runner->>runner: Run setup_all callbacks
    loop each test
      create participant test as Test Process
      runner->>test: Spawn
      test->>test: Run setup callbacks
      test->>test: Run test
      destroy test
      test-xrunner: Exits
      runner->>runner: Run on_exit callbacks
    end
I would be happy with shipping this one! | 
| @josevalim deal, I really like that 🙃 | 
Looks like this:
This is 90% for me because I kind of always forget. Do we like it?