#1044140, #1044032, #1056174 by KarenS and bfroehle, lots of fixes to tests to avoid exception errors and make it more flexible.