Skip to content

Commit

Permalink
Included execution summary #1
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigodiez committed Nov 27, 2017
1 parent 38b9698 commit c0fff9f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/simple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ schema: http
tests:
- url: /data/2.5/weather?q=London,uk&appid=b1b15e88fa797225412429c1c50c122a1
should:
have_status: 200
match_json_schema: ./examples/schemas/Forecast.schema.json
contain: weather
- url: /data/2.5/weather?q=London,uk&appid=b1b15e88fa797225412429c1c50c122a1
should:
have_status: 200
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ var red = color.New(color.FgRed).SprintFunc()
var yellow = color.New(color.FgYellow).SprintFunc()

func main() {
var failedTests = 0

filename := flag.String("testbook", "testbook.yml", "a testbook file")
flag.Parse()

Expand All @@ -35,9 +37,12 @@ func main() {

for _ = range testbook.Tests {
if ok := <-ch; ok == false {
failedTests++
defer os.Exit(1)
}
}

fmt.Printf("%d tests (%s, %s)\n", len(testbook.Tests), green(fmt.Sprintf("%d passed", len(testbook.Tests)-failedTests)), red(fmt.Sprintf("%d failed", failedTests)))
}

func test(test types.Test, host string, schema string, ch chan bool) {
Expand Down

0 comments on commit c0fff9f

Please sign in to comment.