diff --git a/CHANGELOG.md b/CHANGELOG.md index 82247c6..58ea0f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ **2017-04-27** - added an option to randomize scenario execution order, so we could ensure that scenarios do not depend on global state. +- godog was manually sorting feature files by name. Now it just runs them + in given order, you may sort them anyway you like. For example `godog + $(find . -name '*.feature' | sort)` **2016-10-30** - **v0.6.0** - added experimental **events** format, this might be used for unified diff --git a/suite.go b/suite.go index d6c1631..d3b6cbe 100644 --- a/suite.go +++ b/suite.go @@ -9,7 +9,6 @@ import ( "path/filepath" "reflect" "regexp" - "sort" "strconv" "strings" "unicode/utf8" @@ -467,16 +466,9 @@ func parseFeatures(filter string, paths []string) (features []*feature, err erro return features, err } } - sort.Sort(featuresSortedByPath(features)) return } -type featuresSortedByPath []*feature - -func (s featuresSortedByPath) Len() int { return len(s) } -func (s featuresSortedByPath) Less(i, j int) bool { return s[i].Path < s[j].Path } -func (s featuresSortedByPath) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - func applyTagFilter(tags string, ft *gherkin.Feature) { if len(tags) == 0 { return diff --git a/suite_test.go b/suite_test.go index 101e002..aee19f8 100644 --- a/suite_test.go +++ b/suite_test.go @@ -297,12 +297,19 @@ func (s *suiteContext) iShouldHaveNumFeatureFiles(num int, files *gherkin.DocStr return fmt.Errorf("expected %d feature paths to be parsed, but have %d", len(expected), len(actual)) } for i := 0; i < len(expected); i++ { + var matched bool split := strings.Split(expected[i], "/") exp := filepath.Join(split...) - split = strings.Split(actual[i], "/") - act := filepath.Join(split...) - if exp != act { - return fmt.Errorf(`expected feature path "%s" at position: %d, does not match actual "%s"`, exp, i, act) + for j := 0; j < len(actual); j++ { + split = strings.Split(actual[j], "/") + act := filepath.Join(split...) + if exp == act { + matched = true + break + } + } + if !matched { + return fmt.Errorf(`expected feature path "%s" at position: %d, was not parsed, actual are %+v`, exp, i, actual) } } return nil