Beispiel #1
0
func (agent *rephraseRefactorer) performRefactoringOn(specs []*parser.Specification, conceptDictionary *parser.ConceptDictionary) *refactoringResult {
	specsRefactored, conceptFilesRefactored := agent.rephraseInSpecsAndConcepts(&specs, conceptDictionary)

	result := &refactoringResult{Success: false, Errors: make([]string, 0), warnings: make([]string, 0)}
	if !agent.isConcept {
		var runner *runner.TestRunner
		select {
		case runner = <-agent.startChan.RunnerChan:
		case err := <-agent.startChan.ErrorChan:
			result.Errors = append(result.Errors, "Cannot perform refactoring: Unable to connect to runner."+err.Error())
			return result
		}
		defer runner.Kill(execLogger.Current())
		stepName, err, warning := agent.getStepNameFromRunner(runner)
		if err != nil {
			result.Errors = append(result.Errors, err.Error())
			return result
		}
		if warning == nil {
			runnerFilesChanged, err := agent.requestRunnerForRefactoring(runner, stepName)
			if err != nil {
				result.Errors = append(result.Errors, fmt.Sprintf("Cannot perform refactoring: %s", err))
				return result
			}
			result.runnerFilesChanged = runnerFilesChanged
		} else {
			result.warnings = append(result.warnings, warning.Message)
		}
	}
	specFiles, conceptFiles := writeToConceptAndSpecFiles(specs, conceptDictionary, specsRefactored, conceptFilesRefactored)
	result.specsChanged = specFiles
	result.Success = true
	result.conceptsChanged = conceptFiles
	return result
}
Beispiel #2
0
func (e *parallelExecution) startSpecsExecutionWithRunner(s *gauge.SpecCollection, resChan chan *result.SuiteResult, runner *runner.TestRunner, reporter reporter.Reporter) {
	executionInfo := newExecutionInfo(s, runner, e.pluginHandler, reporter, e.errMaps, false)
	se := newSimpleExecution(executionInfo)
	se.execute()
	runner.Kill()
	resChan <- se.suiteResult
}
Beispiel #3
0
func (e *parallelExecution) startSpecsExecutionWithRunner(specStore *specStore, suiteResultsChan chan *result.SuiteResult, runner *runner.TestRunner, reporter reporter.Reporter) {
	executionInfo := newExecutionInfo(e.manifest, specStore, runner, e.pluginHandler, reporter, e.errMaps, false)
	simpleExecution := newExecution(executionInfo)
	simpleExecution.start()
	result := simpleExecution.run()
	runner.Kill()
	suiteResultsChan <- result
}
Beispiel #4
0
func validateSpecs(manifest *manifest.Manifest, specsToExecute []*parser.Specification, runner *runner.TestRunner, conceptDictionary *parser.ConceptDictionary) {
	validator := newValidator(manifest, specsToExecute, runner, conceptDictionary)
	validationErrors := validator.validate()
	if len(validationErrors) > 0 {
		printValidationFailures(validationErrors)
		runner.Kill(execLogger.Current())
		os.Exit(1)
	}
}
func (e *parallelSpecExecution) startSpecsExecutionWithRunner(specCollection *filter.SpecCollection, suiteResults chan *result.SuiteResult, runner *runner.TestRunner, writer execLogger.ExecutionLogger) {
	execution := newExecution(e.manifest, specCollection.Specs, runner, e.pluginHandler, &parallelInfo{inParallel: false}, writer)
	result := execution.start()
	runner.Kill(e.writer)
	suiteResults <- result
}
Beispiel #6
0
func (e *parallelSpecExecution) startSpecsExecutionWithRunner(specCollection *filter.SpecCollection, suiteResults chan *result.SuiteResult, runner *runner.TestRunner, logger *logger.GaugeLogger) {
	execution := newExecution(&executionInfo{e.manifest, specCollection.Specs, runner, e.pluginHandler, &parallelInfo{inParallel: false}, logger, e.errMaps})
	result := execution.start()
	runner.Kill()
	suiteResults <- result
}