Fixed another time calc issue and added a Junit Concurrency run test

Этот коммит содержится в:
Fredrik Lönnblad 2020-01-20 15:23:02 -03:00
родитель 32feb1d1cc
коммит 10ac7158d1
3 изменённых файлов: 19 добавлений и 17 удалений

5
fmt.go
Просмотреть файл

@ -242,8 +242,7 @@ func (f *basefmt) Node(n interface{}) {
case *gherkin.Scenario:
f.owner = t
feature := f.features[len(f.features)-1]
feature.time = timeNowFunc()
feature.Scenarios = append(feature.Scenarios, &scenario{Name: t.Name, time: feature.time})
feature.Scenarios = append(feature.Scenarios, &scenario{Name: t.Name, time: timeNowFunc()})
case *gherkin.ScenarioOutline:
feature := f.features[len(f.features)-1]
feature.Scenarios = append(feature.Scenarios, &scenario{OutlineName: t.Name})
@ -270,7 +269,7 @@ func (f *basefmt) Defined(*gherkin.Step, *StepDef) {
}
func (f *basefmt) Feature(ft *gherkin.Feature, p string, c []byte) {
f.features = append(f.features, &feature{Path: p, Feature: ft})
f.features = append(f.features, &feature{Path: p, Feature: ft, time: timeNowFunc()})
}
func (f *basefmt) Passed(step *gherkin.Step, match *StepDef) {

Просмотреть файл

@ -5,6 +5,7 @@ import (
"fmt"
"io"
"os"
"sort"
"sync"
"time"
@ -125,6 +126,8 @@ func buildJUNITPackageSuite(suiteName string, startedAt time.Time, features []*f
Time: timeNowFunc().Sub(startedAt).String(),
}
sort.Sort(sortByOrderGiven(features))
for idx, feat := range features {
ts := junitTestSuite{
Name: feat.Name,

Просмотреть файл

@ -342,14 +342,6 @@ func TestSucceedWithJunitAndConcurrencyOption(t *testing.T) {
<testcase name="Support of Docstrings" status="passed" time="0s"></testcase>
<testcase name="Support of Undefined, Pending and Skipped status" status="passed" time="0s"></testcase>
</testsuite>
<testsuite name="event stream formatter" tests="3" skipped="0" failures="0" errors="0" time="0s">
<testcase name="should fire only suite events without any scenario" status="passed" time="0s"></testcase>
<testcase name="should process simple scenario" status="passed" time="0s"></testcase>
<testcase name="should process outline scenario" status="passed" time="0s"></testcase>
</testsuite>
<testsuite name="užkrauti savybes" tests="1" skipped="0" failures="0" errors="0" time="0s">
<testcase name="savybių užkrovimas iš aplanko" status="passed" time="0s"></testcase>
</testsuite>
<testsuite name="suite events" tests="6" skipped="0" failures="0" errors="0" time="0s">
<testcase name="triggers before scenario event" status="passed" time="0s"></testcase>
<testcase name="triggers appropriate events for a single scenario" status="passed" time="0s"></testcase>
@ -358,6 +350,14 @@ func TestSucceedWithJunitAndConcurrencyOption(t *testing.T) {
<testcase name="should not trigger events on empty feature" status="passed" time="0s"></testcase>
<testcase name="should not trigger events on empty scenarios" status="passed" time="0s"></testcase>
</testsuite>
<testsuite name="event stream formatter" tests="3" skipped="0" failures="0" errors="0" time="0s">
<testcase name="should fire only suite events without any scenario" status="passed" time="0s"></testcase>
<testcase name="should process simple scenario" status="passed" time="0s"></testcase>
<testcase name="should process outline scenario" status="passed" time="0s"></testcase>
</testsuite>
<testsuite name="užkrauti savybes" tests="1" skipped="0" failures="0" errors="0" time="0s">
<testcase name="savybių užkrovimas iš aplanko" status="passed" time="0s"></testcase>
</testsuite>
<testsuite name="load features" tests="6" skipped="0" failures="0" errors="0" time="0s">
<testcase name="load features within path" status="passed" time="0s"></testcase>
<testcase name="load a specific feature file" status="passed" time="0s"></testcase>
@ -394,12 +394,6 @@ func TestSucceedWithJunitAndConcurrencyOption(t *testing.T) {
<testcase name="should handle string argument followed by comma" status="passed" time="0s"></testcase>
<testcase name="should handle arguments in the beggining or end of the step" status="passed" time="0s"></testcase>
</testsuite>
<testsuite name="tag filters" tests="4" skipped="0" failures="0" errors="0" time="0s">
<testcase name="should filter outline examples by tags" status="passed" time="0s"></testcase>
<testcase name="should filter scenarios by X tag" status="passed" time="0s"></testcase>
<testcase name="should filter scenarios by X tag not having Y" status="passed" time="0s"></testcase>
<testcase name="should filter scenarios having Y and Z tags" status="passed" time="0s"></testcase>
</testsuite>
<testsuite name="run outline" tests="6" skipped="0" failures="0" errors="0" time="0s">
<testcase name="should run a normal outline" status="passed" time="0s"></testcase>
<testcase name="should continue through examples on failure" status="passed" time="0s"></testcase>
@ -408,6 +402,12 @@ func TestSucceedWithJunitAndConcurrencyOption(t *testing.T) {
<testcase name="should translate step doc string argument #1" status="passed" time="0s"></testcase>
<testcase name="should translate step doc string argument #2" status="passed" time="0s"></testcase>
</testsuite>
<testsuite name="tag filters" tests="4" skipped="0" failures="0" errors="0" time="0s">
<testcase name="should filter outline examples by tags" status="passed" time="0s"></testcase>
<testcase name="should filter scenarios by X tag" status="passed" time="0s"></testcase>
<testcase name="should filter scenarios by X tag not having Y" status="passed" time="0s"></testcase>
<testcase name="should filter scenarios having Y and Z tags" status="passed" time="0s"></testcase>
</testsuite>
</testsuites>`
status := RunWithOptions("succeed", func(s *Suite) { SuiteContext(s) }, opt)