예제 #1
0
// Parse all specifications in the project and find all the steps
func (specInfoGatherer *SpecInfoGatherer) findAllStepsFromSpecs() {
	specFiles := util.FindSpecFilesIn(filepath.Join(config.ProjectRoot, common.SpecsDirectoryName))

	availableSpecs, parseResults := parser.ParseSpecFiles(specFiles, specInfoGatherer.getDictionary())
	specInfoGatherer.handleParseFailures(parseResults)

	specInfoGatherer.addStepsForSpecs(availableSpecs)
}
예제 #2
0
파일: gauge.go 프로젝트: Jayasagar/gauge
func getSpecFiles(specSource string) []string {
	specFiles := make([]string, 0)
	if common.DirExists(specSource) {
		specFiles = append(specFiles, util.FindSpecFilesIn(specSource)...)
	} else if common.FileExists(specSource) && util.IsValidSpecExtension(specSource) {
		specFile, _ := filepath.Abs(specSource)
		specFiles = append(specFiles, specFile)
	}
	return specFiles
}
예제 #3
0
func (s *SpecInfoGatherer) initSpecsCache() {
	s.specsCache = make(map[string][]*parser.Specification, 0)
	specFiles := util.FindSpecFilesIn(filepath.Join(config.ProjectRoot, common.SpecsDirectoryName))
	parsedSpecs := s.getParsedSpecs(specFiles)

	logger.ApiLog.Debug("Initializing specs cache with %d specs", len(parsedSpecs))
	for _, spec := range parsedSpecs {
		s.addToSpecsCache(spec.FileName, spec)
	}
}
예제 #4
0
func (s *MySuite) TestGetParsedSpecs(c *C) {
	_, err := util.CreateFileIn(s.specsDir, "spec1.spec", spec1)
	c.Assert(err, Equals, nil)
	specInfoGatherer := &SpecInfoGatherer{SpecDirs: []string{specDir}}

	specFiles := util.FindSpecFilesIn(s.specsDir)
	specs := specInfoGatherer.getParsedSpecs(specFiles)

	c.Assert(len(specs), Equals, 1)
	c.Assert(specs[0].Heading.Value, Equals, "Specification Heading")
}
예제 #5
0
파일: specDetails.go 프로젝트: 0-T-0/gauge
func (s *SpecInfoGatherer) initSpecsCache() {
	defer s.waitGroup.Done()

	s.specsCache = make(map[string][]*gauge.Specification, 0)
	specFiles := util.FindSpecFilesIn(filepath.Join(config.ProjectRoot, common.SpecsDirectoryName))
	parsedSpecs := s.getParsedSpecs(specFiles)

	logger.APILog.Info("Initializing specs cache with %d specs", len(parsedSpecs))
	for _, spec := range parsedSpecs {
		logger.APILog.Debug("Adding specs from %s", spec.FileName)
		s.addToSpecsCache(spec.FileName, spec)
	}
}
예제 #6
0
func (s *SpecInfoGatherer) initSpecsCache() {
	defer s.waitGroup.Done()

	var specFiles []string
	s.specsCache = make(map[string][]*gauge.Specification, 0)

	for _, dir := range s.SpecDirs {
		specFiles = append(specFiles, util.FindSpecFilesIn(filepath.Join(config.ProjectRoot, dir))...)
	}

	parsedSpecs := s.getParsedSpecs(specFiles)

	logger.APILog.Info("Initializing specs cache with %d specs", len(parsedSpecs))
	for _, spec := range parsedSpecs {
		logger.APILog.Debug("Adding specs from %s", spec.FileName)
		s.addToSpecsCache(spec.FileName, spec)
	}
}