Change the way selection history is built, again

Issue #2305
Log stack traces of test errors to the console