From c0fff9fb07166a1dadce6b49a866371b75c61592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20D=C3=ADez=20Villamuera?= Date: Mon, 27 Nov 2017 20:10:12 +0000 Subject: [PATCH] Included execution summary #1 --- examples/simple.yml | 4 +++- main.go | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/simple.yml b/examples/simple.yml index c5dd786..8cab6e0 100644 --- a/examples/simple.yml +++ b/examples/simple.yml @@ -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 diff --git a/main.go b/main.go index bf475de..7d45dd8 100644 --- a/main.go +++ b/main.go @@ -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() @@ -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) {