'Run through a tool test case.'

def do_it(self, testdef, resource_parameters={}):

    shed_tool_id = self.shed_tool_id
    self._handle_test_def_errors(testdef)
    galaxy_interactor = self._galaxy_interactor(testdef)
    test_history = galaxy_interactor.new_history()
    stage_data_in_history(galaxy_interactor, testdef.test_data(), test_history, shed_tool_id)
    tool_inputs = None
    job_stdio = None
    job_output_exceptions = None
    tool_execution_exception = None
    expected_failure_occurred = False
    try:
        try:
            tool_response = galaxy_interactor.run_tool(testdef, test_history, resource_parameters=resource_parameters)
            (data_list, jobs, tool_inputs) = (tool_response.outputs, tool_response.jobs, tool_response.inputs)
            data_collection_list = tool_response.output_collections
        except RunToolException as e:
            tool_inputs = e.inputs
            tool_execution_exception = e
            if (not testdef.expect_failure):
                raise e
            else:
                expected_failure_occurred = True
        except Exception as e:
            tool_execution_exception = e
            raise e
        if (not expected_failure_occurred):
            self.assertTrue((data_list or data_collection_list))
            try:
                job_stdio = self._verify_outputs(testdef, test_history, jobs, shed_tool_id, data_list, data_collection_list, galaxy_interactor)
            except JobOutputsError as e:
                job_stdio = e.job_stdio
                job_output_exceptions = e.output_exceptions
                raise e
            except Exception as e:
                job_output_exceptions = [e]
                raise e
    finally:
        job_data = {}
        if (tool_inputs is not None):
            job_data['inputs'] = tool_inputs
        if (job_stdio is not None):
            job_data['job'] = job_stdio
        if job_output_exceptions:
            job_data['output_problems'] = [str(_) for _ in job_output_exceptions]
        if tool_execution_exception:
            job_data['execution_problem'] = str(tool_execution_exception)
        register_job_data(job_data)
    galaxy_interactor.delete_history(test_history)
