Skip to content

Commit

Permalink
Merge pull request #448 from melnikk/master
Browse files Browse the repository at this point in the history
Added name field to jUnit reported testsuite
  • Loading branch information
williammartin authored Apr 9, 2018
2 parents 468e89e + ae61c63 commit f3996fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions reporters/junit_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
type JUnitTestSuite struct {
XMLName xml.Name `xml:"testsuite"`
TestCases []JUnitTestCase `xml:"testcase"`
Name string `xml:"name,attr"`
Tests int `xml:"tests,attr"`
Failures int `xml:"failures,attr"`
Time float64 `xml:"time,attr"`
Expand Down Expand Up @@ -59,6 +60,7 @@ func NewJUnitReporter(filename string) *JUnitReporter {

func (reporter *JUnitReporter) SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary) {
reporter.suite = JUnitTestSuite{
Name: summary.SuiteDescription,
TestCases: []JUnitTestCase{},
}
reporter.testSuiteName = summary.SuiteDescription
Expand Down
4 changes: 4 additions & 0 deletions reporters/junit_reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ var _ = Describe("JUnit Reporter", func() {

It("should record the test as passing", func() {
output := readOutputFile()
Ω(output.Name).Should(Equal("My test suite"))
Ω(output.Tests).Should(Equal(1))
Ω(output.Failures).Should(Equal(0))
Ω(output.Time).Should(Equal(10.0))
Expand Down Expand Up @@ -112,6 +113,7 @@ var _ = Describe("JUnit Reporter", func() {

It("should record the test as having failed", func() {
output := readOutputFile()
Ω(output.Name).Should(Equal("My test suite"))
Ω(output.Tests).Should(Equal(1))
Ω(output.Failures).Should(Equal(1))
Ω(output.Time).Should(Equal(10.0))
Expand Down Expand Up @@ -150,6 +152,7 @@ var _ = Describe("JUnit Reporter", func() {

It("should record the test as having failed", func() {
output := readOutputFile()
Ω(output.Name).Should(Equal("My test suite"))
Ω(output.Tests).Should(Equal(1))
Ω(output.Failures).Should(Equal(1))
Ω(output.Time).Should(Equal(10.0))
Expand Down Expand Up @@ -200,6 +203,7 @@ var _ = Describe("JUnit Reporter", func() {

It("should record test as failing", func() {
output := readOutputFile()
Ω(output.Name).Should(Equal("My test suite"))
Ω(output.Tests).Should(Equal(1))
Ω(output.Failures).Should(Equal(1))
Ω(output.Time).Should(Equal(10.0))
Expand Down

0 comments on commit f3996fd

Please sign in to comment.