[BUG #8627] Done a minor refactoring to remove DRY on all tests.