示例#1
0
func ExecuteSpecs(inParallel bool, args []string) {
	env.LoadEnv(false)
	conceptsDictionary, conceptParseResult := parser.CreateConceptsDictionary(false)
	parser.HandleParseResult(conceptParseResult)
	specsToExecute, specsSkipped := filter.GetSpecsToExecute(conceptsDictionary, args)
	if len(specsToExecute) == 0 {
		printExecutionStatus(nil, 0)
	}
	parallelInfo := &parallelInfo{inParallel: inParallel, numberOfStreams: NumberOfExecutionStreams}
	if !parallelInfo.isValid() {
		os.Exit(1)
	}
	manifest, err := manifest.ProjectManifest()
	if err != nil {
		execLogger.CriticalError(err)
	}
	runner := startApi()
	validateSpecs(manifest, specsToExecute, runner, conceptsDictionary)
	pluginHandler := plugin.StartPlugins(manifest)
	execution := newExecution(manifest, specsToExecute, runner, pluginHandler, parallelInfo, execLogger.Current())
	result := execution.start()
	execution.finish()
	exitCode := printExecutionStatus(result, specsSkipped)
	os.Exit(exitCode)
}
示例#2
0
func parseSpecs(args []string) ([]*parser.Specification, *parser.ConceptDictionary) {
	conceptsDictionary, conceptParseResult := parser.CreateConceptsDictionary(false)
	parser.HandleParseResult(conceptParseResult)
	specsToExecute, _ := filter.GetSpecsToExecute(conceptsDictionary, args)
	if len(specsToExecute) == 0 {
		printExecutionStatus(nil, &validationErrMaps{})
	}
	return specsToExecute, conceptsDictionary
}
示例#3
0
func parseSpecs(args []string) ([]*gauge.Specification, *gauge.ConceptDictionary) {
	conceptsDictionary, conceptParseResult := parser.CreateConceptsDictionary(false, args)
	parser.HandleParseResult(conceptParseResult)
	specsToExecute, _ := filter.GetSpecsToExecute(conceptsDictionary, args)
	if len(specsToExecute) == 0 {
		logger.Info("No specifications found in %s.", strings.Join(args, ", "))
		os.Exit(0)
	}
	return specsToExecute, conceptsDictionary
}
示例#4
0
func specsFromArgs(conceptDictionary *parser.ConceptDictionary, args []string) []*parser.Specification {
	allSpecs := make([]*parser.Specification, 0)
	specs := make([]*parser.Specification, 0)
	var specParseResults []*parser.ParseResult
	for _, arg := range args {
		specSource := arg
		if isIndexedSpec(specSource) {
			specs, specParseResults = getSpecWithScenarioIndex(specSource, conceptDictionary)
		} else {
			specs, specParseResults = parser.FindSpecs(specSource, conceptDictionary)
		}
		parser.HandleParseResult(specParseResults...)
		allSpecs = append(allSpecs, specs...)
	}
	return allSpecs
}
示例#5
0
func specsFromArgs(conceptDictionary *gauge.ConceptDictionary, specDirs []string) []*gauge.Specification {
	var allSpecs []*gauge.Specification
	var specs []*gauge.Specification
	var specParseResults []*parser.ParseResult
	for _, arg := range specDirs {
		specSource := arg
		if isIndexedSpec(specSource) {
			specs, specParseResults = getSpecWithScenarioIndex(specSource, conceptDictionary)
		} else {
			specs, specParseResults = parser.ParseSpecFiles(util.GetSpecFiles(specSource), conceptDictionary)
		}
		parser.HandleParseResult(specParseResults...)
		allSpecs = append(allSpecs, specs...)
	}
	return allSpecs
}
示例#6
0
func FormatSpecFilesIn(filesLocation string) {
	specFiles := util.GetSpecFiles(filesLocation)
	parseResults := FormatSpecFiles(specFiles...)
	parser.HandleParseResult(parseResults...)
}