Using cucumber format to produce an HTML report with Cucumber HTML reporter #557
Unanswered
robert-ovens
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I think I understand now how to proceed. It really involved looking through the godog source code :-) The func TestFeatures(t *testing.T) {
f, err := os.Create("./report.json")
check(err)
suite := godog.TestSuite{
TestSuiteInitializer: InitializeTestSuite,
ScenarioInitializer: InitializeScenario,
Options: &godog.Options{
Format: "cucumber",
Output: f,
Paths: []string{"features"},
TestingT: t, // Testing instance that will run subtests.
},
}
if suite.Run() != 0 {
t.Fatal("non-zero status returned, failed to run feature tests")
}
f.Close()
}
Props to godog authors - a very nice library :-) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
Versions
I am attempting to produce an HTML report of the godog output. The output does contain the desired json, however it also outputs the default output appended to the end.
A sample test will include the function
And the test is executed thusly
go test ./api
../api/
is the folder containing the tests. The output is;So, the desired json for conversion with Cucumber HTML Reporter, but additional output which I do not want. My goal is to generate the test results as cucumber json so I can gnerate HTML reports in our CI/CD pipeline.
test
correctly (new to Go)Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions