To run a main or test function at the caret, press &shortcut:ShowIntentionActions; and select the Run intention action.

Run with the intention action