Skip to content

Conversation

@whatyouhide
Copy link
Member

Looks like this:

CleanShot 2025-03-27 at 19 06 10@2x

This is 90% for me because I kind of always forget. Do we like it?

@josevalim
Copy link
Member

Would a sequence diagram work better? http://mermaid.js.org/syntax/sequenceDiagram.html

@whatyouhide
Copy link
Member Author

@josevalim maybe but I find it harder to read, while this looks really simple to me. I don't have a strong pref though :)

@josevalim
Copy link
Member

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
Loading

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
Loading

@whatyouhide
Copy link
Member Author

Let me get my Mermaid fu out then. You're on

@whatyouhide
Copy link
Member Author

@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
Loading

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.

@josevalim
Copy link
Member

josevalim commented Mar 27, 2025

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
Loading

I would be happy with shipping this one!

@whatyouhide
Copy link
Member Author

@josevalim deal, I really like that 🙃

@whatyouhide whatyouhide merged commit 7b71138 into main Mar 27, 2025
18 of 20 checks passed
@whatyouhide whatyouhide deleted the andrea/mermaid-exunit branch March 27, 2025 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants