Trigger Click in Unit Test?

My application has no audio processing, everything relies on the GUI which creates midi output based on what was clicked.
To this end, I want to try to mimic my processor so I can automate GUI testing. Part of this means I would like to trigger button clicks in my unit tests.

So far I was messing around with this simple syntax:

    void runTest() override
        beginTest ("Test");
            juce::TextButton b;
            juce::TextButton upInv;
            b.setButtonText("C maj");
            std::vector<short> midiNotes = Chords.getMidiNotesfromChord (&b);
            upInv.onClick = [this,&b] {chordInversionUpCallback(Chords,&b); };

And the triggerClick() does not “succeed” in triggering a click. Confirmed because I have a breakpoint in the chordInversionUpCallback() method which is not executed.
Either I have a very simple syntax mistake or I’m out of my depth here.

I don’t fully understand the implications of having components in unit tests, or triggering clicks. Is this valid? Is there a better way to do this? What am I doing wrong?