fixes #16793. Second half of test refactoring. Thanks Sebastien Brunot (IBM, CCLA).