You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cmd.Flags().MarkDeprecated("json", "please use --output instead")
247
247
cmd.Flags().VarP(&opts.Output, "output", "o", "output format for the test report (available format: text, json, junit)")
248
248
cmd.Flags().BoolVar(&opts.NoColor, "no-color", false, "no color in the output")
249
+
cmd.Flags().StringVar(&opts.JunitSuiteName, "junit-suite-name", "", fmt.Sprintf("name to use for the junit test suite (defaults to '%s')", output.DefaultJunitSuiteName))
expected: `<?xml version="1.0" encoding="UTF-8"?><testsuites failures="1" tests="2" time="2e-09"><testsuite name="container-structure-test.test"><testcase name="my first test" time="1e-09"><system-out>it works!</system-out><system-err></system-err></testcase><testcase name="my fail" time="1e-09"><failure>this failed because of that</failure><system-out></system-out><system-err>this failed</system-err></testcase></testsuite></testsuites>`,
48
52
},
53
+
{
54
+
actual: bytes.NewBuffer([]byte{}),
55
+
format: unversioned.Junit,
56
+
name: "junit-custom-suite-name",
57
+
expected: `<?xml version="1.0" encoding="UTF-8"?><testsuites failures="1" tests="2" time="2e-09"><testsuite name="`+customSuiteName+`"><testcase name="my first test" time="1e-09"><system-out>it works!</system-out><system-err></system-err></testcase><testcase name="my fail" time="1e-09"><failure>this failed because of that</failure><system-out></system-out><system-err>this failed</system-err></testcase></testsuite></testsuites>`,
58
+
},
49
59
{
50
60
actual: bytes.NewBuffer([]byte{}),
51
61
format: unversioned.Json,
62
+
name: "json",
52
63
expected: `{"Pass":1,"Fail":1,"Total":2,"Duration":2,"Results":[{"Name":"my first test","Pass":true,"Stdout":"it works!","Duration":1},{"Name":"my fail","Pass":false,"Stderr":"this failed","Errors":["this failed because of that"],"Duration":1}]}`,
0 commit comments