Tests for issue 5997 failure and success conditions.

Closes #5997.