make application context for test framework more consistent with runtime

backport of #441.