-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
35 lines (29 loc) · 905 Bytes
/
Copy pathmain.go
File metadata and controls
35 lines (29 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"context"
"flag"
"fmt"
"os"
"github.com/rohansunder/go-api-test-runner/config"
"github.com/rohansunder/go-api-test-runner/httpclient"
"github.com/rohansunder/go-api-test-runner/report"
"github.com/rohansunder/go-api-test-runner/runner"
)
func main() {
file := flag.String("file", "testdata/example.yaml", "path to the YAML test suite file")
parallel := flag.Int("parallel", 1, "number of tests to run concurrently")
verbose := flag.Bool("verbose", false, "print passing assertions alongside failures")
flag.Parse()
suite, err := config.Load(*file)
if err != nil {
fmt.Fprintf(os.Stderr, "error loading config: %v\n", err)
os.Exit(1)
}
client := httpclient.New()
r := runner.New(client, *parallel)
results := r.Run(context.Background(), suite)
passed, total := report.Print(os.Stdout, suite.Name, results, *verbose)
if passed < total {
os.Exit(1)
}
}