Adding ability to do a test run with test=True. #18966
Merge pull request #19014 from nmadhok/fix-state-file-serialize

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