Fix[test_api]: printOnFailure check current invoker (#1533)

Closes #1340

This PR adds a check within printOnFailure and throw an exception if there is no current invoker.
7 files changed