Backported and adapted IntegrationTestCase from later versions