instance_factory testing utility