func (s *MySuite) TestNumberOfStreams(c *C) {
	specs := createSpecsList(6)
	e := parallelExecution{numberOfExecutionStreams: 5, specCollection: gauge.NewSpecCollection(specs)}
	c.Assert(e.numberOfStreams(), Equals, 5)

	specs = createSpecsList(6)
	e = parallelExecution{numberOfExecutionStreams: 10, specCollection: gauge.NewSpecCollection(specs)}
	c.Assert(e.numberOfStreams(), Equals, 6)

	specs = createSpecsList(0)
	e = parallelExecution{numberOfExecutionStreams: 17, specCollection: gauge.NewSpecCollection(specs)}
	c.Assert(e.numberOfStreams(), Equals, 0)
}
Beispiel #2
0
func (s *MySuite) TestFunctionsOfTypeSpecList(c *C) {
	mySpecs := gauge.NewSpecCollection(createSpecsList(4))
	c.Assert(mySpecs.Next().FileName, Equals, "spec0")
	c.Assert(mySpecs.Next().FileName, Equals, "spec1")
	c.Assert(mySpecs.HasNext(), Equals, true)
	c.Assert(mySpecs.Size(), Equals, 4)
	c.Assert(mySpecs.Next().FileName, Equals, "spec2")
	c.Assert(mySpecs.Next().FileName, Equals, "spec3")
	c.Assert(mySpecs.HasNext(), Equals, false)
}
Beispiel #3
0
func DistributeSpecs(specifications []*gauge.Specification, distributions int) []*gauge.SpecCollection {
	s := make([]*gauge.SpecCollection, distributions)
	for i := 0; i < len(specifications); i++ {
		mod := i % distributions
		if s[mod] == nil {
			s[mod] = gauge.NewSpecCollection(make([]*gauge.Specification, 0))
		}
		s[mod].Add(specifications[i])
	}
	return s
}
Beispiel #4
0
func ValidateSpecs(args []string, r *runner.TestRunner) (*gauge.SpecCollection, *ValidationErrMaps) {
	s, c := parseSpecs(args)
	manifest, err := manifest.ProjectManifest()
	if err != nil {
		logger.Fatalf(err.Error())
	}
	v := newValidator(manifest, s, r, c)
	vErrs := v.validate()
	errMap := &ValidationErrMaps{
		SpecErrs:     make(map[*gauge.Specification][]*StepValidationError),
		ScenarioErrs: make(map[*gauge.Scenario][]*StepValidationError),
		StepErrs:     make(map[*gauge.Step]*StepValidationError),
	}

	if len(vErrs) > 0 {
		printValidationFailures(vErrs)
		fillErrors(errMap, vErrs)
	}
	return gauge.NewSpecCollection(s), errMap
}