Move all unit tests main functions into shared space
Unify wait methods