Write comprehensive integration test