Adding ability to do a test run with test=True.

Fixes #18966