Port back latest changes to testing framework.