Skip to content

Commit

Permalink
Remove Ω from junit reporter test
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Martin authored and williammartin committed Jun 18, 2020
1 parent 820dfab commit 4fcfb02
Showing 1 changed file with 75 additions and 75 deletions.
150 changes: 75 additions & 75 deletions reporters/junit_reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ var _ = Describe("JUnit Reporter", func() {

readOutputFile := func() reporters.JUnitTestSuite {
bytes, err := ioutil.ReadFile(outputFile)
Ω(err).ShouldNot(HaveOccurred())
Expect(err).ToNot(HaveOccurred())
var suite reporters.JUnitTestSuite
err = xml.Unmarshal(bytes, &suite)
Ω(err).ShouldNot(HaveOccurred())
Expect(err).ToNot(HaveOccurred())
return suite
}

BeforeEach(func() {
f, err := ioutil.TempFile("", "output")
Ω(err).ShouldNot(HaveOccurred())
Expect(err).ToNot(HaveOccurred())
f.Close()
outputFile = f.Name()

Expand Down Expand Up @@ -82,18 +82,18 @@ var _ = Describe("JUnit Reporter", func() {

It("should record the test as passing, including detailed output", func() {
output := readOutputFile()
Ω(output.Name).Should(Equal("My test suite"))
Ω(output.Tests).Should(Equal(1))
Ω(output.Failures).Should(Equal(0))
Ω(output.Time).Should(Equal(reportedSuiteTime))
Ω(output.Errors).Should(Equal(0))
Ω(output.TestCases).Should(HaveLen(1))
Ω(output.TestCases[0].Name).Should(Equal("A B C"))
Ω(output.TestCases[0].ClassName).Should(Equal("My test suite"))
Ω(output.TestCases[0].FailureMessage).Should(BeNil())
Ω(output.TestCases[0].Skipped).Should(BeNil())
Ω(output.TestCases[0].Time).Should(Equal(5.0))
Ω(output.TestCases[0].PassedMessage.Message).Should(ContainSubstring("Test scenario"))
Expect(output.Name).To(Equal("My test suite"))
Expect(output.Tests).To(Equal(1))
Expect(output.Failures).To(Equal(0))
Expect(output.Time).To(Equal(reportedSuiteTime))
Expect(output.Errors).To(Equal(0))
Expect(output.TestCases).To(HaveLen(1))
Expect(output.TestCases[0].Name).To(Equal("A B C"))
Expect(output.TestCases[0].ClassName).To(Equal("My test suite"))
Expect(output.TestCases[0].FailureMessage).To(BeNil())
Expect(output.TestCases[0].Skipped).To(BeNil())
Expect(output.TestCases[0].Time).To(Equal(5.0))
Expect(output.TestCases[0].PassedMessage.Message).To(ContainSubstring("Test scenario"))
})
})

Expand All @@ -116,13 +116,13 @@ var _ = Describe("JUnit Reporter", func() {

// Set the ReportFile config flag with a new directory and new file path to be created.
d, err := ioutil.TempDir("", "new-junit-dir")
Ω(err).ShouldNot(HaveOccurred())
Expect(err).ToNot(HaveOccurred())
f, err := ioutil.TempFile(d, "output")
Ω(err).ShouldNot(HaveOccurred())
Expect(err).ToNot(HaveOccurred())
f.Close()
outputFile = f.Name()
err = os.RemoveAll(d)
Ω(err).ShouldNot(HaveOccurred())
Expect(err).ToNot(HaveOccurred())
reporter.ReporterConfig.ReportFile = outputFile

spec := &types.SpecSummary{
Expand All @@ -144,17 +144,17 @@ var _ = Describe("JUnit Reporter", func() {

It("should create the report (and parent directories) as specified by ReportFile path", func() {
output := readOutputFile()
Ω(output.Name).Should(Equal("My test suite"))
Ω(output.Tests).Should(Equal(1))
Ω(output.Failures).Should(Equal(0))
Ω(output.Time).Should(Equal(reportedSuiteTime))
Ω(output.Errors).Should(Equal(0))
Ω(output.TestCases).Should(HaveLen(1))
Ω(output.TestCases[0].Name).Should(Equal("A B C"))
Ω(output.TestCases[0].ClassName).Should(Equal("My test suite"))
Ω(output.TestCases[0].FailureMessage).Should(BeNil())
Ω(output.TestCases[0].Skipped).Should(BeNil())
Ω(output.TestCases[0].Time).Should(Equal(5.0))
Expect(output.Name).To(Equal("My test suite"))
Expect(output.Tests).To(Equal(1))
Expect(output.Failures).To(Equal(0))
Expect(output.Time).To(Equal(reportedSuiteTime))
Expect(output.Errors).To(Equal(0))
Expect(output.TestCases).To(HaveLen(1))
Expect(output.TestCases[0].Name).To(Equal("A B C"))
Expect(output.TestCases[0].ClassName).To(Equal("My test suite"))
Expect(output.TestCases[0].FailureMessage).To(BeNil())
Expect(output.TestCases[0].Skipped).To(BeNil())
Expect(output.TestCases[0].Time).To(Equal(5.0))
})
})

Expand Down Expand Up @@ -182,19 +182,19 @@ 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(reportedSuiteTime))
Ω(output.Errors).Should(Equal(0))
Ω(output.TestCases[0].Name).Should(Equal("BeforeSuite"))
Ω(output.TestCases[0].Time).Should(Equal(3.0))
Ω(output.TestCases[0].ClassName).Should(Equal("My test suite"))
Ω(output.TestCases[0].FailureMessage.Type).Should(Equal("Failure"))
Ω(output.TestCases[0].FailureMessage.Message).Should(ContainSubstring("failed to setup"))
Ω(output.TestCases[0].FailureMessage.Message).Should(ContainSubstring(beforeSuite.Failure.ComponentCodeLocation.String()))
Ω(output.TestCases[0].FailureMessage.Message).Should(ContainSubstring(beforeSuite.Failure.Location.String()))
Ω(output.TestCases[0].Skipped).Should(BeNil())
Expect(output.Name).To(Equal("My test suite"))
Expect(output.Tests).To(Equal(1))
Expect(output.Failures).To(Equal(1))
Expect(output.Time).To(Equal(reportedSuiteTime))
Expect(output.Errors).To(Equal(0))
Expect(output.TestCases[0].Name).To(Equal("BeforeSuite"))
Expect(output.TestCases[0].Time).To(Equal(3.0))
Expect(output.TestCases[0].ClassName).To(Equal("My test suite"))
Expect(output.TestCases[0].FailureMessage.Type).To(Equal("Failure"))
Expect(output.TestCases[0].FailureMessage.Message).To(ContainSubstring("failed to setup"))
Expect(output.TestCases[0].FailureMessage.Message).To(ContainSubstring(beforeSuite.Failure.ComponentCodeLocation.String()))
Expect(output.TestCases[0].FailureMessage.Message).To(ContainSubstring(beforeSuite.Failure.Location.String()))
Expect(output.TestCases[0].Skipped).To(BeNil())
})
})

Expand Down Expand Up @@ -222,19 +222,19 @@ 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(reportedSuiteTime))
Ω(output.Errors).Should(Equal(0))
Ω(output.TestCases[0].Name).Should(Equal("AfterSuite"))
Ω(output.TestCases[0].Time).Should(Equal(3.0))
Ω(output.TestCases[0].ClassName).Should(Equal("My test suite"))
Ω(output.TestCases[0].FailureMessage.Type).Should(Equal("Failure"))
Ω(output.TestCases[0].FailureMessage.Message).Should(ContainSubstring("failed to setup"))
Ω(output.TestCases[0].FailureMessage.Message).Should(ContainSubstring(afterSuite.Failure.ComponentCodeLocation.String()))
Ω(output.TestCases[0].FailureMessage.Message).Should(ContainSubstring(afterSuite.Failure.Location.String()))
Ω(output.TestCases[0].Skipped).Should(BeNil())
Expect(output.Name).To(Equal("My test suite"))
Expect(output.Tests).To(Equal(1))
Expect(output.Failures).To(Equal(1))
Expect(output.Time).To(Equal(reportedSuiteTime))
Expect(output.Errors).To(Equal(0))
Expect(output.TestCases[0].Name).To(Equal("AfterSuite"))
Expect(output.TestCases[0].Time).To(Equal(3.0))
Expect(output.TestCases[0].ClassName).To(Equal("My test suite"))
Expect(output.TestCases[0].FailureMessage.Type).To(Equal("Failure"))
Expect(output.TestCases[0].FailureMessage.Message).To(ContainSubstring("failed to setup"))
Expect(output.TestCases[0].FailureMessage.Message).To(ContainSubstring(afterSuite.Failure.ComponentCodeLocation.String()))
Expect(output.TestCases[0].FailureMessage.Message).To(ContainSubstring(afterSuite.Failure.Location.String()))
Expect(output.TestCases[0].Skipped).To(BeNil())
})
})

Expand Down Expand Up @@ -278,21 +278,21 @@ 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(reportedSuiteTime))
Ω(output.Errors).Should(Equal(0))
Ω(output.TestCases[0].Name).Should(Equal("A B C"))
Ω(output.TestCases[0].ClassName).Should(Equal("My test suite"))
Ω(output.TestCases[0].FailureMessage.Type).Should(Equal(specStateCase.message))
Ω(output.TestCases[0].FailureMessage.Message).Should(ContainSubstring("I failed"))
Ω(output.TestCases[0].FailureMessage.Message).Should(ContainSubstring(spec.Failure.ComponentCodeLocation.String()))
Ω(output.TestCases[0].FailureMessage.Message).Should(ContainSubstring(spec.Failure.Location.String()))
Ω(output.TestCases[0].Skipped).Should(BeNil())
Expect(output.Name).To(Equal("My test suite"))
Expect(output.Tests).To(Equal(1))
Expect(output.Failures).To(Equal(1))
Expect(output.Time).To(Equal(reportedSuiteTime))
Expect(output.Errors).To(Equal(0))
Expect(output.TestCases[0].Name).To(Equal("A B C"))
Expect(output.TestCases[0].ClassName).To(Equal("My test suite"))
Expect(output.TestCases[0].FailureMessage.Type).To(Equal(specStateCase.message))
Expect(output.TestCases[0].FailureMessage.Message).To(ContainSubstring("I failed"))
Expect(output.TestCases[0].FailureMessage.Message).To(ContainSubstring(spec.Failure.ComponentCodeLocation.String()))
Expect(output.TestCases[0].FailureMessage.Message).To(ContainSubstring(spec.Failure.Location.String()))
Expect(output.TestCases[0].Skipped).To(BeNil())
if specStateCase.state == types.SpecStatePanicked {
Ω(output.TestCases[0].FailureMessage.Message).Should(ContainSubstring("\nPanic: " + specStateCase.forwardedPanic + "\n"))
Ω(output.TestCases[0].FailureMessage.Message).Should(ContainSubstring("\nFull stack:\n" + spec.Failure.Location.FullStackTrace))
Expect(output.TestCases[0].FailureMessage.Message).To(ContainSubstring("\nPanic: " + specStateCase.forwardedPanic + "\n"))
Expect(output.TestCases[0].FailureMessage.Message).To(ContainSubstring("\nFull stack:\n" + spec.Failure.Location.FullStackTrace))
}
})
})
Expand Down Expand Up @@ -320,12 +320,12 @@ var _ = Describe("JUnit Reporter", func() {

It("should record test as failing", func() {
output := readOutputFile()
Ω(output.Tests).Should(Equal(1))
Ω(output.Failures).Should(Equal(0))
Ω(output.Time).Should(Equal(reportedSuiteTime))
Ω(output.Errors).Should(Equal(0))
Ω(output.TestCases[0].Name).Should(Equal("A B C"))
Ω(output.TestCases[0].Skipped).ShouldNot(BeNil())
Expect(output.Tests).To(Equal(1))
Expect(output.Failures).To(Equal(0))
Expect(output.Time).To(Equal(reportedSuiteTime))
Expect(output.Errors).To(Equal(0))
Expect(output.TestCases[0].Name).To(Equal("A B C"))
Expect(output.TestCases[0].Skipped).ToNot(BeNil())
})
})
}
Expand Down

0 comments on commit 4fcfb02

Please sign in to comment.