Best Ginkgo code snippet using reporters_test.RE
default_reporter_test.go
Source:default_reporter_test.go
...101 }102 }103 return report104}105func RE(name string, cl types.CodeLocation, args ...interface{}) types.ReportEntry {106 entry, _ := internal.NewReportEntry(name, cl, args...)107 entry.Time = PLACEHOLDER_TIME108 return entry109}110type ConfigFlags uint8111const (112 Succinct ConfigFlags = 1 << iota113 Verbose114 VeryVerbose115 ReportPassed116 FullTrace117)118func (cf ConfigFlags) Has(flag ConfigFlags) bool { return cf&flag != 0 }119func C(flags ...ConfigFlags) types.ReporterConfig {120 f := ConfigFlags(0)121 if len(flags) > 0 {122 f = flags[0]123 }124 Ω(f.Has(Verbose) && f.Has(Succinct)).Should(BeFalse(), "Setting more than one of Succinct, Verbose, or VeryVerbose is a configuration error")125 Ω(f.Has(VeryVerbose) && f.Has(Succinct)).Should(BeFalse(), "Setting more than one of Succinct, Verbose, or VeryVerbose is a configuration error")126 Ω(f.Has(VeryVerbose) && f.Has(Verbose)).Should(BeFalse(), "Setting more than one of Succinct, Verbose, or VeryVerbose is a configuration error")127 return types.ReporterConfig{128 NoColor: true,129 SlowSpecThreshold: SlowSpecThreshold,130 Succinct: f.Has(Succinct),131 Verbose: f.Has(Verbose),132 VeryVerbose: f.Has(VeryVerbose),133 AlwaysEmitGinkgoWriter: f.Has(ReportPassed),134 FullTrace: f.Has(FullTrace),135 }136}137const SlowSpecThreshold = 3 * time.Second138var _ = Describe("DefaultReporter", func() {139 var DENOTER = "â¢"140 var RETRY_DENOTER = "âº"141 if runtime.GOOS == "windows" {142 DENOTER = "+"143 RETRY_DENOTER = "R"144 }145 var buf *gbytes.Buffer146 verifyExpectedOutput := func(expected []string) {147 if len(expected) == 0 {148 ExpectWithOffset(1, buf.Contents()).Should(BeEmpty())149 } else {150 ExpectWithOffset(1, string(buf.Contents())).Should(Equal(strings.Join(expected, "\n")), test_helpers.MultilneTextHelper(string(buf.Contents())))151 }152 }153 BeforeEach(func() {154 buf = gbytes.NewBuffer()155 format.CharactersAroundMismatchToInclude = 100156 })157 DescribeTable("Rendering SuiteWillBegin",158 func(conf types.ReporterConfig, report types.Report, expected ...string) {159 reporter := reporters.NewDefaultReporterUnderTest(conf, buf)160 reporter.SuiteWillBegin(report)161 verifyExpectedOutput(expected)162 },163 Entry("Default Behavior",164 C(),165 types.Report{166 SuiteDescription: "My Suite", SuitePath: "/path/to/suite", PreRunStats: types.PreRunStats{SpecsThatWillRun: 15, TotalSpecs: 20},167 SuiteConfig: types.SuiteConfig{RandomSeed: 17, ParallelTotal: 1},168 },169 "Running Suite: My Suite - /path/to/suite",170 "========================================",171 "Random Seed: {{bold}}17{{/}}",172 "",173 "Will run {{bold}}15{{/}} of {{bold}}20{{/}} specs",174 "",175 ),176 Entry("With Labels",177 C(),178 types.Report{179 SuiteDescription: "My Suite", SuitePath: "/path/to/suite", SuiteLabels: []string{"dog", "fish"}, PreRunStats: types.PreRunStats{SpecsThatWillRun: 15, TotalSpecs: 20},180 SuiteConfig: types.SuiteConfig{RandomSeed: 17, ParallelTotal: 1},181 },182 "Running Suite: My Suite - /path/to/suite",183 "{{coral}}[dog, fish]{{/}} ",184 "========================================",185 "Random Seed: {{bold}}17{{/}}",186 "",187 "Will run {{bold}}15{{/}} of {{bold}}20{{/}} specs",188 "",189 ),190 Entry("With long Labels",191 C(),192 types.Report{193 SuiteDescription: "My Suite", SuitePath: "/path/to/suite", SuiteLabels: []string{"dog", "fish", "kalamazoo", "kangaroo", "chicken", "asparagus"}, PreRunStats: types.PreRunStats{SpecsThatWillRun: 15, TotalSpecs: 20},194 SuiteConfig: types.SuiteConfig{RandomSeed: 17, ParallelTotal: 1},195 },196 "Running Suite: My Suite - /path/to/suite",197 "{{coral}}[dog, fish, kalamazoo, kangaroo, chicken, asparagus]{{/}} ",198 "====================================================",199 "Random Seed: {{bold}}17{{/}}",200 "",201 "Will run {{bold}}15{{/}} of {{bold}}20{{/}} specs",202 "",203 ),204 Entry("When configured to randomize all specs",205 C(),206 types.Report{207 SuiteDescription: "My Suite", SuitePath: "/path/to/suite", PreRunStats: types.PreRunStats{SpecsThatWillRun: 15, TotalSpecs: 20},208 SuiteConfig: types.SuiteConfig{RandomSeed: 17, ParallelTotal: 1, RandomizeAllSpecs: true},209 },210 "Running Suite: My Suite - /path/to/suite",211 "========================================",212 "Random Seed: {{bold}}17{{/}} - will randomize all specs",213 "",214 "Will run {{bold}}15{{/}} of {{bold}}20{{/}} specs",215 "",216 ),217 Entry("when configured to run in parallel",218 C(),219 types.Report{220 SuiteDescription: "My Suite", SuitePath: "/path/to/suite", PreRunStats: types.PreRunStats{SpecsThatWillRun: 15, TotalSpecs: 20},221 SuiteConfig: types.SuiteConfig{RandomSeed: 17, ParallelTotal: 3},222 },223 "Running Suite: My Suite - /path/to/suite",224 "========================================",225 "Random Seed: {{bold}}17{{/}}",226 "",227 "Will run {{bold}}15{{/}} of {{bold}}20{{/}} specs",228 "Running in parallel across {{bold}}3{{/}} processes",229 "",230 ),231 Entry("when succinct and in series",232 C(Succinct),233 types.Report{234 SuiteDescription: "My Suite", SuitePath: "/path/to/suite", PreRunStats: types.PreRunStats{SpecsThatWillRun: 15, TotalSpecs: 20},235 SuiteConfig: types.SuiteConfig{RandomSeed: 17, ParallelTotal: 1},236 },237 "[17] {{bold}}My Suite{{/}} - 15/20 specs ",238 ),239 Entry("when succinct and in parallel",240 C(Succinct),241 types.Report{242 SuiteDescription: "My Suite", SuitePath: "/path/to/suite", PreRunStats: types.PreRunStats{SpecsThatWillRun: 15, TotalSpecs: 20},243 SuiteConfig: types.SuiteConfig{RandomSeed: 17, ParallelTotal: 3},244 },245 "[17] {{bold}}My Suite{{/}} - 15/20 specs - 3 procs ",246 ),247 Entry("when succinct and with labels",248 C(Succinct),249 types.Report{250 SuiteDescription: "My Suite", SuitePath: "/path/to/suite", SuiteLabels: Label("dog, fish"), PreRunStats: types.PreRunStats{SpecsThatWillRun: 15, TotalSpecs: 20},251 SuiteConfig: types.SuiteConfig{RandomSeed: 17, ParallelTotal: 3},252 },253 "[17] {{bold}}My Suite{{/}} {{coral}}[dog, fish]{{/}} - 15/20 specs - 3 procs ",254 ),255 )256 DescribeTable("WillRun",257 func(conf types.ReporterConfig, report types.SpecReport, output ...string) {258 reporter := reporters.NewDefaultReporterUnderTest(conf, buf)259 reporter.WillRun(report)260 verifyExpectedOutput(output)261 },262 Entry("when not verbose, it emits nothing", C(), S(CTS("A"), CLS(cl0))),263 Entry("pending specs are not emitted", C(Verbose), S(types.SpecStatePending)),264 Entry("skipped specs are not emitted", C(Verbose), S(types.SpecStateSkipped)),265 Entry("setup nodes", C(Verbose),266 S(types.NodeTypeBeforeSuite, cl0),267 DELIMITER,268 "{{bold}}[BeforeSuite] {{/}}",269 "{{gray}}"+cl0.String()+"{{/}}",270 "",271 ),272 Entry("ReportAfterSuite nodes", C(Verbose),273 S("my report", cl0, types.NodeTypeReportAfterSuite),274 DELIMITER,275 "{{bold}}[ReportAfterSuite] my report{{/}}",276 "{{gray}}"+cl0.String()+"{{/}}",277 "",278 ),279 Entry("top-level it nodes", C(Verbose),280 S("My Test", cl0),281 DELIMITER,282 "{{bold}}My Test{{/}}",283 "{{gray}}"+cl0.String()+"{{/}}",284 "",285 ),286 Entry("nested it nodes", C(Verbose),287 S(CTS("Container", "Nested Container"), "My Test", CLS(cl0, cl1), cl2),288 DELIMITER,289 "{{/}}Container {{gray}}Nested Container{{/}}",290 " {{bold}}My Test{{/}}",291 " {{gray}}"+cl2.String()+"{{/}}",292 "",293 ),294 Entry("specs with labels", C(Verbose),295 S(CTS("Container", "Nested Container"), "My Test", CLS(cl0, cl1), cl2, CLabels(Label("dog", "cat"), Label("cat", "fruit")), Label("giraffe", "gorilla", "cat")),296 DELIMITER,297 "{{/}}Container {{gray}}Nested Container{{/}}",298 " {{bold}}My Test{{/}} {{coral}}[dog, cat, fruit, giraffe, gorilla]{{/}}",299 " {{gray}}"+cl2.String()+"{{/}}",300 "",301 ),302 )303 DescribeTable("DidRun",304 func(conf types.ReporterConfig, report types.SpecReport, output ...string) {305 reporter := reporters.NewDefaultReporterUnderTest(conf, buf)306 reporter.DidRun(report)307 verifyExpectedOutput(output)308 },309 // Passing Tests310 Entry("a passing test",311 C(),312 S("A", cl0),313 "{{green}}"+DENOTER+"{{/}}",314 ),315 Entry("a passing test that was retried",316 C(),317 S(CTS("A"), "B", CLS(cl0), cl1, 2),318 DELIMITER,319 "{{green}}"+RETRY_DENOTER+" [FLAKEY TEST - TOOK 2 ATTEMPTS TO PASS] [1.000 seconds]{{/}}",320 "{{/}}A {{gray}}B{{/}}",321 "{{gray}}"+cl1.String()+"{{/}}",322 DELIMITER,323 "",324 ),325 Entry("a passing test that has ginkgo writer output and/or non-visible report entries",326 C(),327 S("A", cl0, GW("GINKGO-WRITER-OUTPUT"), RE("fail-report-name", cl1, types.ReportEntryVisibilityFailureOrVerbose), RE("hidden-report-name", cl2, types.ReportEntryVisibilityNever)),328 "{{green}}"+DENOTER+"{{/}}",329 ),330 Entry("a passing test that has ginkgo writer output, with ReportPassed configured",331 C(ReportPassed),332 S(CTS("A"), "B", CLS(cl0), cl1, GW("GINKGO-WRITER-OUTPUT\nSHOULD EMIT")),333 DELIMITER,334 "{{green}}"+DENOTER+" [1.000 seconds]{{/}}",335 "{{/}}A {{gray}}B{{/}}",336 "{{gray}}"+cl1.String()+"{{/}}",337 "",338 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",339 " GINKGO-WRITER-OUTPUT",340 " SHOULD EMIT",341 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",342 DELIMITER,343 "",344 ),345 Entry("a passing test that has ginkgo writer output and a FailurOrVerbose entry, with Verbose configured",346 C(Verbose),347 S("A", cl0, GW("GINKGO-WRITER-OUTPUT\nSHOULD EMIT"), RE("failure-or-verbose-report-name", cl1, types.ReportEntryVisibilityFailureOrVerbose), RE("hidden-report-name", cl2, types.ReportEntryVisibilityNever)),348 DELIMITER,349 "{{green}}"+DENOTER+" [1.000 seconds]{{/}}",350 "A",351 "{{gray}}"+cl0.String()+"{{/}}",352 "",353 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",354 " GINKGO-WRITER-OUTPUT",355 " SHOULD EMIT",356 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",357 "",358 " {{gray}}Begin Report Entries >>{{/}}",359 " {{bold}}failure-or-verbose-report-name{{gray}} - "+cl1.String()+" @ "+FORMATTED_TIME+"{{/}}",360 " {{gray}}<< End Report Entries{{/}}",361 DELIMITER,362 "",363 ),364 Entry("a slow passing test",365 C(),366 S(CTS("A"), "B", CLS(cl0), cl1, time.Minute, GW("GINKGO-WRITER-OUTPUT")),367 DELIMITER,368 "{{green}}"+DENOTER+" [SLOW TEST] [60.000 seconds]{{/}}",369 "{{/}}A {{gray}}B{{/}}",370 "{{gray}}"+cl1.String()+"{{/}}",371 DELIMITER,372 "",373 ),374 Entry("a passing test with captured stdout",375 C(),376 S(CTS("A"), "B", CLS(cl0), cl1, GW("GINKGO-WRITER-OUTPUT"), STD("STD-OUTPUT\nSHOULD EMIT")),377 DELIMITER,378 "{{green}}"+DENOTER+" [1.000 seconds]{{/}}",379 "{{/}}A {{gray}}B{{/}}",380 "{{gray}}"+cl1.String()+"{{/}}",381 "",382 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",383 " STD-OUTPUT",384 " SHOULD EMIT",385 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",386 DELIMITER,387 "",388 ),389 Entry("a passing test with a ReportEntry that is always visible",390 C(),391 S(CTS("A"), "B", CLS(cl0), cl1, GW("GINKGO-WRITER-OUTPUT"), RE("report-name", cl2, "report-content"), RE("other-report-name", cl3), RE("fail-report-name", cl4, types.ReportEntryVisibilityFailureOrVerbose)),392 DELIMITER,393 "{{green}}"+DENOTER+" [1.000 seconds]{{/}}",394 "{{/}}A {{gray}}B{{/}}",395 "{{gray}}"+cl1.String()+"{{/}}",396 "",397 " {{gray}}Begin Report Entries >>{{/}}",398 " {{bold}}report-name{{gray}} - "+cl2.String()+" @ "+FORMATTED_TIME+"{{/}}",399 " report-content",400 " {{bold}}other-report-name{{gray}} - "+cl3.String()+" @ "+FORMATTED_TIME+"{{/}}",401 " {{gray}}<< End Report Entries{{/}}",402 DELIMITER,403 "",404 ),405 Entry("a passing suite setup emits nothing",406 C(),407 S(types.NodeTypeBeforeSuite, cl0, GW("GINKGO-WRITER-OUTPUT")),408 ),409 Entry("a passing suite setup with verbose always emits",410 C(Verbose),411 S(types.NodeTypeBeforeSuite, cl0, GW("GINKGO-WRITER-OUTPUT")),412 DELIMITER,413 "{{green}}[BeforeSuite] PASSED [1.000 seconds]{{/}}",414 "[BeforeSuite] ",415 "{{gray}}"+cl0.String()+"{{/}}",416 "",417 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",418 " GINKGO-WRITER-OUTPUT",419 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",420 DELIMITER,421 "",422 ),423 Entry("a passing suite setup with captured stdout always emits",424 C(),425 S(types.NodeTypeBeforeSuite, cl0, STD("STD-OUTPUT")),426 DELIMITER,427 "{{green}}[BeforeSuite] PASSED [1.000 seconds]{{/}}",428 "{{/}}[BeforeSuite] {{/}}",429 "{{gray}}"+cl0.String()+"{{/}}",430 "",431 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",432 " STD-OUTPUT",433 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",434 DELIMITER,435 "",436 ),437 Entry("a passing ReportAfterSuite emits nothing",438 C(),439 S("my report", types.NodeTypeReportAfterSuite, cl0, GW("GINKGO-WRITER-OUTPUT")),440 ),441 Entry("a passing ReportAfterSuite with verbose always emits",442 C(Verbose),443 S("my report", types.NodeTypeReportAfterSuite, cl0, GW("GINKGO-WRITER-OUTPUT")),444 DELIMITER,445 "{{green}}[ReportAfterSuite] PASSED [1.000 seconds]{{/}}",446 "[ReportAfterSuite] my report",447 "{{gray}}"+cl0.String()+"{{/}}",448 "",449 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",450 " GINKGO-WRITER-OUTPUT",451 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",452 DELIMITER,453 "",454 ),455 Entry("a passing ReportAfterSuite with captured stdout always emits",456 C(),457 S("my report", types.NodeTypeReportAfterSuite, cl0, STD("STD-OUTPUT")),458 DELIMITER,459 "{{green}}[ReportAfterSuite] PASSED [1.000 seconds]{{/}}",460 "{{/}}[ReportAfterSuite] my report{{/}}",461 "{{gray}}"+cl0.String()+"{{/}}",462 "",463 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",464 " STD-OUTPUT",465 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",466 DELIMITER,467 "",468 ),469 Entry("a passing ReportAfterSuite with verbose always emits",470 C(Verbose),471 S("my report", types.NodeTypeReportAfterSuite, cl0, GW("GINKGO-WRITER-OUTPUT")),472 DELIMITER,473 "{{green}}[ReportAfterSuite] PASSED [1.000 seconds]{{/}}",474 "[ReportAfterSuite] my report",475 "{{gray}}"+cl0.String()+"{{/}}",476 "",477 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",478 " GINKGO-WRITER-OUTPUT",479 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",480 DELIMITER,481 "",482 ),483 Entry("a passing Suite-level DeferCleanup emits nothing",484 C(),485 S(types.NodeTypeCleanupAfterSuite, cl0, GW("GINKGO-WRITER-OUTPUT")),486 ),487 Entry("a passing Suite-level DeferCleanup with verbose always emits",488 C(Verbose),489 S(types.NodeTypeCleanupAfterSuite, cl0, GW("GINKGO-WRITER-OUTPUT")),490 DELIMITER,491 "{{green}}[DeferCleanup (Suite)] PASSED [1.000 seconds]{{/}}",492 "[DeferCleanup (Suite)] ",493 "{{gray}}cl0.go:12{{/}}",494 "",495 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",496 " GINKGO-WRITER-OUTPUT",497 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",498 DELIMITER,499 "",500 ),501 // Pending Tests502 Entry("a pending test when succinct",503 C(Succinct),504 S("A", cl0, types.SpecStatePending, GW("GW-OUTPUT"), STD("STD-OUTPUT")),505 "{{yellow}}P{{/}}",506 ),507 Entry("a pending test normally",508 C(),509 S("A", cl0, types.SpecStatePending, GW("GW-OUTPUT")),510 DELIMITER,511 "{{yellow}}P [PENDING]{{/}}",512 "{{/}}A{{/}}",513 "{{gray}}cl0.go:12{{/}}",514 DELIMITER,515 "",516 ),517 Entry("a pending test when verbose",518 C(Verbose),519 S("A", cl0, types.SpecStatePending, GW("GW-OUTPUT")),520 DELIMITER,521 "{{yellow}}P [PENDING]{{/}}",522 "{{/}}A{{/}}",523 "{{gray}}cl0.go:12{{/}}",524 DELIMITER,525 "",526 ),527 Entry("a pending test when very verbose",528 C(VeryVerbose),529 S(CTS("A"), "B", CLS(cl0), cl1, types.SpecStatePending, GW("GW-OUTPUT"), STD("STD-OUTPUT")),530 DELIMITER,531 "{{yellow}}P [PENDING]{{/}}",532 "A",533 "{{gray}}"+cl0.String()+"{{/}}",534 " B",535 " {{gray}}"+cl1.String()+"{{/}}",536 "",537 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",538 " STD-OUTPUT",539 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",540 DELIMITER,541 "",542 ),543 // Skipped Tests544 Entry("a skipped test without a failure message when succinct",545 C(Succinct),546 S("A", cl0, types.SpecStateSkipped, GW("GW-OUTPUT")),547 "{{cyan}}S{{/}}",548 ),549 Entry("a skipped test without a failure message",550 C(),551 S("A", cl0, types.SpecStateSkipped, GW("GW-OUTPUT")),552 "{{cyan}}S{{/}}",553 ),554 Entry("a skipped test without a failure message when verbose",555 C(Verbose),556 S("A", cl0, types.SpecStateSkipped, GW("GW-OUTPUT")),557 "{{cyan}}S{{/}}",558 ),559 Entry("a skipped test without a failure message when very verbose",560 C(VeryVerbose),561 S("A", cl0, types.SpecStateSkipped, GW("GW-OUTPUT")),562 "{{gray}}------------------------------{{/}}",563 "{{cyan}}S [SKIPPED] [1.000 seconds]{{/}}",564 "A",565 "{{gray}}cl0.go:12{{/}}",566 "",567 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",568 " GW-OUTPUT",569 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",570 "{{gray}}------------------------------{{/}}",571 "",572 ),573 Entry("a skipped test with a failure message when succinct",574 C(Succinct),575 S(CTS("A"), "B", CLS(cl0), cl1, types.SpecStateSkipped, GW("GW-OUTPUT"), STD("STD-OUTPUT"),576 F("user skipped", types.FailureNodeIsLeafNode, types.NodeTypeIt, FailureNodeLocation(cl1), cl2),577 ),578 DELIMITER,579 "{{cyan}}S [SKIPPED] [1.000 seconds]{{/}}",580 "{{/}}A {{gray}}{{cyan}}{{bold}}[It] B{{/}}{{/}}",581 "{{gray}}"+cl1.String()+"{{/}}",582 "",583 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",584 " STD-OUTPUT",585 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",586 "",587 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",588 " GW-OUTPUT",589 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",590 "",591 " {{cyan}}user skipped{{/}}",592 " {{cyan}}In {{bold}}[It]{{/}}{{cyan}} at: {{bold}}"+cl2.String()+"{{/}}",593 DELIMITER,594 "",595 ),596 Entry("a skipped test with a failure message and normal verbosity",597 C(),598 S(CTS("A"), "B", CLS(cl0), cl1, types.SpecStateSkipped, GW("GW-OUTPUT"), STD("STD-OUTPUT"),599 F("user skipped", types.FailureNodeIsLeafNode, types.NodeTypeIt, FailureNodeLocation(cl1), cl2),600 ),601 DELIMITER,602 "{{cyan}}S [SKIPPED] [1.000 seconds]{{/}}",603 "A",604 "{{gray}}"+cl0.String()+"{{/}}",605 " {{cyan}}{{bold}}[It] B{{/}}",606 " {{gray}}"+cl1.String()+"{{/}}",607 "",608 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",609 " STD-OUTPUT",610 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",611 "",612 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",613 " GW-OUTPUT",614 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",615 "",616 " {{cyan}}user skipped{{/}}",617 " {{cyan}}In {{bold}}[It]{{/}}{{cyan}} at: {{bold}}"+cl2.String()+"{{/}}",618 DELIMITER,619 "",620 ),621 Entry("a skipped test with a failure message and verbose",622 C(Verbose),623 S(CTS("A"), "B", CLS(cl0), cl1, types.SpecStateSkipped, GW("GW-OUTPUT"), STD("STD-OUTPUT"),624 F("user skipped", types.FailureNodeIsLeafNode, types.NodeTypeIt, FailureNodeLocation(cl1), cl2),625 ),626 DELIMITER,627 "{{cyan}}S [SKIPPED] [1.000 seconds]{{/}}",628 "A",629 "{{gray}}"+cl0.String()+"{{/}}",630 " {{cyan}}{{bold}}[It] B{{/}}",631 " {{gray}}"+cl1.String()+"{{/}}",632 "",633 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",634 " STD-OUTPUT",635 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",636 "",637 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",638 " GW-OUTPUT",639 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",640 "",641 " {{cyan}}user skipped{{/}}",642 " {{cyan}}In {{bold}}[It]{{/}}{{cyan}} at: {{bold}}"+cl2.String()+"{{/}}",643 DELIMITER,644 "",645 ),646 Entry("a skipped test with a failure message and very verbose",647 C(VeryVerbose),648 S(CTS("A"), "B", CLS(cl0), cl1, types.SpecStateSkipped, GW("GW-OUTPUT"), STD("STD-OUTPUT"),649 F("user skipped", types.FailureNodeIsLeafNode, types.NodeTypeIt, FailureNodeLocation(cl1), cl2),650 ),651 DELIMITER,652 "{{cyan}}S [SKIPPED] [1.000 seconds]{{/}}",653 "A",654 "{{gray}}"+cl0.String()+"{{/}}",655 " {{cyan}}{{bold}}[It] B{{/}}",656 " {{gray}}"+cl1.String()+"{{/}}",657 "",658 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",659 " STD-OUTPUT",660 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",661 "",662 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",663 " GW-OUTPUT",664 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",665 "",666 " {{cyan}}user skipped{{/}}",667 " {{cyan}}In {{bold}}[It]{{/}}{{cyan}} at: {{bold}}"+cl2.String()+"{{/}}",668 DELIMITER,669 "",670 ),671 //Failed tests672 Entry("when a test has failed in an It",673 C(),674 S(CTS("Describe A", "Context B"), "The Test", CLS(cl0, cl1), cl2, CLabels(Label("dog", "cat"), Label("cat", "cow")),675 types.SpecStateFailed, 2,676 Label("cow", "fish"),677 GW("GW-OUTPUT\nIS EMITTED"), STD("STD-OUTPUT\nIS EMITTED"),678 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeIsLeafNode, types.NodeTypeIt, FailureNodeLocation(cl2), cl3),679 RE("report-name", cl4, "report-content"),680 RE("fail-report-name", cl4, "fail-report-content", types.ReportEntryVisibilityFailureOrVerbose),681 RE("hidden-report-name", cl4, "hidden-report-content", types.ReportEntryVisibilityNever),682 ),683 DELIMITER,684 "{{red}}"+DENOTER+" [FAILED] [1.000 seconds]{{/}}",685 "Describe A {{coral}}[dog, cat]{{/}}",686 "{{gray}}"+cl0.String()+"{{/}}",687 " Context B {{coral}}[cat, cow]{{/}}",688 " {{gray}}"+cl1.String()+"{{/}}",689 " {{red}}{{bold}}[It] The Test{{/}} {{coral}}[cow, fish]{{/}}",690 " {{gray}}"+cl2.String()+"{{/}}",691 "",692 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",693 " STD-OUTPUT",694 " IS EMITTED",695 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",696 "",697 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",698 " GW-OUTPUT",699 " IS EMITTED",700 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",701 "",702 " {{gray}}Begin Report Entries >>{{/}}",703 " {{bold}}report-name{{gray}} - "+cl4.String()+" @ "+FORMATTED_TIME+"{{/}}",704 " report-content",705 " {{bold}}fail-report-name{{gray}} - "+cl4.String()+" @ "+FORMATTED_TIME+"{{/}}",706 " fail-report-content",707 " {{gray}}<< End Report Entries{{/}}",708 "",709 " {{red}}FAILURE MESSAGE",710 " WITH DETAILS{{/}}",711 " {{red}}In {{bold}}[It]{{/}}{{red}} at: {{bold}}"+cl3.String()+"{{/}}",712 DELIMITER,713 "",714 ),715 Entry("when a test has failed in a setup/teardown node",716 C(),717 S(CTS("Describe A", "Context B"), "The Test", CLS(cl0, cl1), cl2,718 types.SpecStateFailed, 2,719 GW("GW-OUTPUT\nIS EMITTED"), STD("STD-OUTPUT\nIS EMITTED"),720 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeInContainer, FailureNodeLocation(cl3), types.NodeTypeJustBeforeEach, 1, cl4),721 ),722 DELIMITER,723 "{{red}}"+DENOTER+" [FAILED] [1.000 seconds]{{/}}",724 "Describe A",725 "{{gray}}"+cl0.String()+"{{/}}",726 " {{red}}{{bold}}Context B [JustBeforeEach]{{/}}",727 " {{gray}}"+cl3.String()+"{{/}}",728 " The Test",729 " {{gray}}"+cl2.String()+"{{/}}",730 "",731 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",732 " STD-OUTPUT",733 " IS EMITTED",734 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",735 "",736 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",737 " GW-OUTPUT",738 " IS EMITTED",739 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",740 "",741 " {{red}}FAILURE MESSAGE",742 " WITH DETAILS{{/}}",743 " {{red}}In {{bold}}[JustBeforeEach]{{/}}{{red}} at: {{bold}}"+cl4.String()+"{{/}}",744 DELIMITER,745 "",746 ),747 Entry("when a test has failed in a setup/teardown node defined at the top level",748 C(),749 S(CTS("Describe A", "Context B"), "The Test", CLS(cl0, cl1), cl2,750 types.SpecStateFailed, 2,751 GW("GW-OUTPUT\nIS EMITTED"), STD("STD-OUTPUT\nIS EMITTED"),752 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeAtTopLevel, FailureNodeLocation(cl3), types.NodeTypeJustBeforeEach, 1, cl4),753 ),754 DELIMITER,755 "{{red}}"+DENOTER+" [FAILED] [1.000 seconds]{{/}}",756 "{{red}}{{bold}}TOP-LEVEL [JustBeforeEach]{{/}}",757 "{{gray}}"+cl3.String()+"{{/}}",758 " Describe A",759 " {{gray}}"+cl0.String()+"{{/}}",760 " Context B",761 " {{gray}}"+cl1.String()+"{{/}}",762 " The Test",763 " {{gray}}"+cl2.String()+"{{/}}",764 "",765 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",766 " STD-OUTPUT",767 " IS EMITTED",768 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",769 "",770 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",771 " GW-OUTPUT",772 " IS EMITTED",773 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",774 "",775 " {{red}}FAILURE MESSAGE",776 " WITH DETAILS{{/}}",777 " {{red}}In {{bold}}[JustBeforeEach]{{/}}{{red}} at: {{bold}}"+cl4.String()+"{{/}}",778 DELIMITER,779 ""),780 Entry("when a test has failed in a setup/teardown node and Succinct is configured",781 C(Succinct),782 S(CTS("Describe A", "Context B"), "The Test", CLS(cl0, cl1), cl2,783 types.SpecStateFailed, 2,784 GW("GW-OUTPUT\nIS EMITTED"), STD("STD-OUTPUT\nIS EMITTED"),785 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeInContainer, FailureNodeLocation(cl3), types.NodeTypeJustBeforeEach, 1, cl4),786 ),787 DELIMITER,788 "{{red}}"+DENOTER+" [FAILED] [1.000 seconds]{{/}}",789 "{{/}}Describe A {{gray}}{{red}}{{bold}}Context B [JustBeforeEach]{{/}} {{/}}The Test{{/}}",790 "{{gray}}"+cl2.String()+"{{/}}",791 "",792 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",793 " STD-OUTPUT",794 " IS EMITTED",795 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",796 "",797 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",798 " GW-OUTPUT",799 " IS EMITTED",800 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",801 "",802 " {{red}}FAILURE MESSAGE",803 " WITH DETAILS{{/}}",804 " {{red}}In {{bold}}[JustBeforeEach]{{/}}{{red}} at: {{bold}}"+cl4.String()+"{{/}}",805 DELIMITER,806 "",807 ),808 Entry("when a test has failed and FullTrace is configured",809 C(FullTrace),810 S(CTS("Describe A", "Context B"), "The Test", CLS(cl0, cl1), cl2,811 types.SpecStateFailed, 2,812 GW("GW-OUTPUT\nIS EMITTED"), STD("STD-OUTPUT\nIS EMITTED"),813 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeInContainer, FailureNodeLocation(cl3), types.NodeTypeJustBeforeEach, 1, cl4),814 ),815 DELIMITER,816 "{{red}}"+DENOTER+" [FAILED] [1.000 seconds]{{/}}",817 "Describe A",818 "{{gray}}"+cl0.String()+"{{/}}",819 " {{red}}{{bold}}Context B [JustBeforeEach]{{/}}",820 " {{gray}}"+cl3.String()+"{{/}}",821 " The Test",822 " {{gray}}"+cl2.String()+"{{/}}",823 "",824 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",825 " STD-OUTPUT",826 " IS EMITTED",827 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",828 "",829 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",830 " GW-OUTPUT",831 " IS EMITTED",832 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",833 "",834 " {{red}}FAILURE MESSAGE",835 " WITH DETAILS{{/}}",836 " {{red}}In {{bold}}[JustBeforeEach]{{/}}{{red}} at: {{bold}}"+cl4.String()+"{{/}}",837 "",838 " {{red}}Full Stack Trace{{/}}",839 " full-trace",840 " cl-4",841 DELIMITER,842 "",843 ),844 Entry("when a suite setup node has failed",845 C(),846 S(types.NodeTypeSynchronizedBeforeSuite, cl0, types.SpecStateFailed, 1,847 GW("GW-OUTPUT\nIS EMITTED"), STD("STD-OUTPUT\nIS EMITTED"),848 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeIsLeafNode, FailureNodeLocation(cl0), types.NodeTypeSynchronizedBeforeSuite, 1, cl1),849 ),850 DELIMITER,851 "{{red}}[SynchronizedBeforeSuite] [FAILED] [1.000 seconds]{{/}}",852 "{{red}}{{bold}}[SynchronizedBeforeSuite] {{/}}",853 "{{gray}}"+cl0.String()+"{{/}}",854 "",855 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",856 " STD-OUTPUT",857 " IS EMITTED",858 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",859 "",860 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",861 " GW-OUTPUT",862 " IS EMITTED",863 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",864 "",865 " {{red}}FAILURE MESSAGE",866 " WITH DETAILS{{/}}",867 " {{red}}In {{bold}}[SynchronizedBeforeSuite]{{/}}{{red}} at: {{bold}}"+cl1.String()+"{{/}}",868 DELIMITER,869 "",870 ),871 Entry("when a ReportAfterSuite node has failed",872 C(),873 S("my report", cl0, types.NodeTypeReportAfterSuite, types.SpecStateFailed, 1,874 GW("GW-OUTPUT\nIS EMITTED"), STD("STD-OUTPUT\nIS EMITTED"),875 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeIsLeafNode, FailureNodeLocation(cl0), types.NodeTypeReportAfterSuite, 1, cl1),876 ),877 DELIMITER,878 "{{red}}[ReportAfterSuite] [FAILED] [1.000 seconds]{{/}}",879 "{{red}}{{bold}}[ReportAfterSuite] my report{{/}}",880 "{{gray}}"+cl0.String()+"{{/}}",881 "",882 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",883 " STD-OUTPUT",884 " IS EMITTED",885 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",886 "",887 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",888 " GW-OUTPUT",889 " IS EMITTED",890 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",891 "",892 " {{red}}FAILURE MESSAGE",893 " WITH DETAILS{{/}}",894 " {{red}}In {{bold}}[ReportAfterSuite]{{/}}{{red}} at: {{bold}}"+cl1.String()+"{{/}}",895 DELIMITER,896 "",897 ),898 Entry("when a test has panicked and there is no forwarded panic",899 C(),900 S(CTS("Describe A", "Context B"), "The Test", CLS(cl0, cl1), cl2,901 types.SpecStatePanicked, 2,902 GW("GW-OUTPUT\nIS EMITTED"), STD("STD-OUTPUT\nIS EMITTED"),903 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeInContainer, FailureNodeLocation(cl3), types.NodeTypeJustBeforeEach, 1, cl4),904 ),905 DELIMITER,906 "{{magenta}}"+DENOTER+"! [PANICKED] [1.000 seconds]{{/}}",907 "Describe A",908 "{{gray}}"+cl0.String()+"{{/}}",909 " {{magenta}}{{bold}}Context B [JustBeforeEach]{{/}}",910 " {{gray}}"+cl3.String()+"{{/}}",911 " The Test",912 " {{gray}}"+cl2.String()+"{{/}}",913 "",914 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",915 " STD-OUTPUT",916 " IS EMITTED",917 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",918 "",919 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",920 " GW-OUTPUT",921 " IS EMITTED",922 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",923 "",924 " {{magenta}}FAILURE MESSAGE",925 " WITH DETAILS{{/}}",926 " {{magenta}}In {{bold}}[JustBeforeEach]{{/}}{{magenta}} at: {{bold}}"+cl4.String()+"{{/}}",927 DELIMITER,928 "",929 ),930 Entry("when a test has panicked and there is a forwarded panic",931 C(),932 S(CTS("Describe A", "Context B"), "The Test", CLS(cl0, cl1), cl2,933 types.SpecStatePanicked, 2,934 GW("GW-OUTPUT\nIS EMITTED"), STD("STD-OUTPUT\nIS EMITTED"),935 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeInContainer, FailureNodeLocation(cl3), types.NodeTypeJustBeforeEach, 1, cl4, ForwardedPanic("the panic\nthusly forwarded")),936 ),937 DELIMITER,938 "{{magenta}}"+DENOTER+"! [PANICKED] [1.000 seconds]{{/}}",939 "Describe A",940 "{{gray}}"+cl0.String()+"{{/}}",941 " {{magenta}}{{bold}}Context B [JustBeforeEach]{{/}}",942 " {{gray}}"+cl3.String()+"{{/}}",943 " The Test",944 " {{gray}}"+cl2.String()+"{{/}}",945 "",946 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",947 " STD-OUTPUT",948 " IS EMITTED",949 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",950 "",951 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",952 " GW-OUTPUT",953 " IS EMITTED",954 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",955 "",956 " {{magenta}}FAILURE MESSAGE",957 " WITH DETAILS{{/}}",958 " {{magenta}}In {{bold}}[JustBeforeEach]{{/}}{{magenta}} at: {{bold}}"+cl4.String()+"{{/}}",959 "",960 " {{magenta}}the panic",961 " thusly forwarded{{/}}",962 "",963 " {{magenta}}Full Stack Trace{{/}}",964 " full-trace",965 " cl-4",966 DELIMITER,967 "",968 ),969 Entry("when a test is interrupted",970 C(),971 S(CTS("Describe A", "Context B"), "The Test", CLS(cl0, cl1), cl2,972 types.SpecStateInterrupted, 2,973 GW("GW-OUTPUT\nIS EMITTED"), STD("STD-OUTPUT\nIS EMITTED"),974 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeInContainer, FailureNodeLocation(cl3), types.NodeTypeJustBeforeEach, 1, cl4),975 ),976 DELIMITER,977 "{{orange}}"+DENOTER+"! [INTERRUPTED] [1.000 seconds]{{/}}",978 "Describe A",979 "{{gray}}"+cl0.String()+"{{/}}",980 " {{orange}}{{bold}}Context B [JustBeforeEach]{{/}}",981 " {{gray}}"+cl3.String()+"{{/}}",982 " The Test",983 " {{gray}}"+cl2.String()+"{{/}}",984 "",985 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",986 " STD-OUTPUT",987 " IS EMITTED",988 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",989 "",990 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",991 " GW-OUTPUT",992 " IS EMITTED",993 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",994 "",995 " {{orange}}FAILURE MESSAGE",996 " WITH DETAILS{{/}}",997 " {{orange}}In {{bold}}[JustBeforeEach]{{/}}{{orange}} at: {{bold}}"+cl4.String()+"{{/}}",998 DELIMITER,999 "",1000 ),1001 Entry("when a test is aborted",1002 C(),1003 S(CTS("Describe A", "Context B"), "The Test", CLS(cl0, cl1), cl2,1004 types.SpecStateAborted, 2,1005 GW("GW-OUTPUT\nIS EMITTED"), STD("STD-OUTPUT\nIS EMITTED"),1006 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeInContainer, FailureNodeLocation(cl3), types.NodeTypeJustBeforeEach, 1, cl4),1007 ),1008 DELIMITER,1009 "{{coral}}"+DENOTER+"! [ABORTED] [1.000 seconds]{{/}}",1010 "Describe A",1011 "{{gray}}"+cl0.String()+"{{/}}",1012 " {{coral}}{{bold}}Context B [JustBeforeEach]{{/}}",1013 " {{gray}}"+cl3.String()+"{{/}}",1014 " The Test",1015 " {{gray}}"+cl2.String()+"{{/}}",1016 "",1017 " {{gray}}Begin Captured StdOut/StdErr Output >>{{/}}",1018 " STD-OUTPUT",1019 " IS EMITTED",1020 " {{gray}}<< End Captured StdOut/StdErr Output{{/}}",1021 "",1022 " {{gray}}Begin Captured GinkgoWriter Output >>{{/}}",1023 " GW-OUTPUT",1024 " IS EMITTED",1025 " {{gray}}<< End Captured GinkgoWriter Output{{/}}",1026 "",1027 " {{coral}}FAILURE MESSAGE",1028 " WITH DETAILS{{/}}",1029 " {{coral}}In {{bold}}[JustBeforeEach]{{/}}{{coral}} at: {{bold}}"+cl4.String()+"{{/}}",1030 DELIMITER,1031 "",1032 ))1033 DescribeTable("Rendering SuiteDidEnd",1034 func(conf types.ReporterConfig, report types.Report, expected ...string) {1035 reporter := reporters.NewDefaultReporterUnderTest(conf, buf)1036 reporter.SuiteDidEnd(report)1037 verifyExpectedOutput(expected)1038 },1039 Entry("when configured to be succinct",1040 C(Succinct),1041 types.Report{1042 SuiteSucceeded: true,1043 RunTime: time.Minute,1044 SpecReports: types.SpecReports{S()},1045 },1046 " {{green}}SUCCESS!{{/}} 1m0s ",1047 ),1048 Entry("the suite passes",1049 C(),1050 types.Report{1051 SuiteSucceeded: true,1052 PreRunStats: types.PreRunStats{TotalSpecs: 8, SpecsThatWillRun: 8},1053 RunTime: time.Minute,1054 SpecReports: types.SpecReports{1055 S(types.NodeTypeBeforeSuite),1056 S(types.SpecStatePassed), S(types.SpecStatePassed), S(types.SpecStatePassed),1057 S(types.SpecStatePending), S(types.SpecStatePending),1058 S(types.SpecStateSkipped), S(types.SpecStateSkipped), S(types.SpecStateSkipped),1059 S(types.NodeTypeAfterSuite),1060 },1061 },1062 "",1063 "{{green}}{{bold}}Ran 3 of 8 Specs in 60.000 seconds{{/}}",1064 "{{green}}{{bold}}SUCCESS!{{/}} -- {{green}}{{bold}}3 Passed{{/}} | {{red}}{{bold}}0 Failed{{/}} | {{yellow}}{{bold}}2 Pending{{/}} | {{cyan}}{{bold}}3 Skipped{{/}}",1065 "",1066 ),1067 Entry("the suite passes and has flaky specs",1068 C(),1069 types.Report{1070 SuiteSucceeded: true,1071 PreRunStats: types.PreRunStats{TotalSpecs: 10, SpecsThatWillRun: 8},1072 RunTime: time.Minute,1073 SpecReports: types.SpecReports{1074 S(types.NodeTypeBeforeSuite),1075 S(types.SpecStatePassed), S(types.SpecStatePassed), S(types.SpecStatePassed),1076 S(types.SpecStatePassed, 3), S(types.SpecStatePassed, 4), //flakey1077 S(types.SpecStatePending), S(types.SpecStatePending),1078 S(types.SpecStateSkipped), S(types.SpecStateSkipped), S(types.SpecStateSkipped),1079 S(types.NodeTypeAfterSuite),1080 },1081 },1082 "",1083 "{{green}}{{bold}}Ran 5 of 10 Specs in 60.000 seconds{{/}}",1084 "{{green}}{{bold}}SUCCESS!{{/}} -- {{green}}{{bold}}5 Passed{{/}} | {{red}}{{bold}}0 Failed{{/}} | {{light-yellow}}{{bold}}2 Flaked{{/}} | {{yellow}}{{bold}}2 Pending{{/}} | {{cyan}}{{bold}}3 Skipped{{/}}",1085 "",1086 ),1087 Entry("the suite fails with one failed test",1088 C(),1089 types.Report{1090 SuiteSucceeded: false,1091 PreRunStats: types.PreRunStats{TotalSpecs: 11, SpecsThatWillRun: 9},1092 RunTime: time.Minute,1093 SpecReports: types.SpecReports{1094 S(types.NodeTypeBeforeSuite),1095 S(types.SpecStatePassed), S(types.SpecStatePassed), S(types.SpecStatePassed),1096 S(types.SpecStatePassed, 3), S(types.SpecStatePassed, 4), //flakey1097 S(types.SpecStatePending), S(types.SpecStatePending),1098 S(types.SpecStateSkipped), S(types.SpecStateSkipped), S(types.SpecStateSkipped),1099 S(CTS("Describe A", "Context B"), "The Test", CLS(cl0, cl1), cl2,1100 types.SpecStateFailed, 2,1101 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeInContainer, FailureNodeLocation(cl3), types.NodeTypeJustBeforeEach, 1, cl4),1102 ),1103 S(types.NodeTypeAfterSuite),1104 },1105 },1106 "",1107 "{{red}}{{bold}}Ran 6 of 11 Specs in 60.000 seconds{{/}}",1108 "{{red}}{{bold}}FAIL!{{/}} -- {{green}}{{bold}}5 Passed{{/}} | {{red}}{{bold}}1 Failed{{/}} | {{light-yellow}}{{bold}}2 Flaked{{/}} | {{yellow}}{{bold}}2 Pending{{/}} | {{cyan}}{{bold}}3 Skipped{{/}}",1109 "",1110 ),1111 Entry("the suite fails with multiple failed tests",1112 C(),1113 types.Report{1114 SuiteSucceeded: false,1115 PreRunStats: types.PreRunStats{TotalSpecs: 13, SpecsThatWillRun: 9},1116 RunTime: time.Minute,1117 SpecReports: types.SpecReports{1118 S(types.NodeTypeBeforeSuite),1119 S(types.SpecStatePassed), S(types.SpecStatePassed), S(types.SpecStatePassed),1120 S(types.SpecStatePassed, 3), S(types.SpecStatePassed, 4), //flakey1121 S(types.SpecStatePending), S(types.SpecStatePending),1122 S(types.SpecStateSkipped), S(types.SpecStateSkipped), S(types.SpecStateSkipped),1123 S(CTS("Describe A", "Context B"), "The Test", CLS(cl0, cl1), cl2, CLabels(Label("cat", "dog"), Label("dog", "fish")), Label("fish", "giraffe"),1124 types.SpecStateFailed, 2,1125 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeInContainer, FailureNodeLocation(cl3), types.NodeTypeJustBeforeEach, 1, cl4),1126 ),1127 S(CTS("Describe A"), "The Test", CLS(cl0), cl1,1128 types.SpecStatePanicked, 2,1129 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeIsLeafNode, FailureNodeLocation(cl1), types.NodeTypeIt, cl2),1130 ),1131 S("The Test", cl0,1132 types.SpecStateInterrupted, 2,1133 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeIsLeafNode, FailureNodeLocation(cl0), types.NodeTypeIt, cl1),1134 ),1135 S("The Test", cl0,1136 types.SpecStateAborted, 2,1137 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeIsLeafNode, FailureNodeLocation(cl0), types.NodeTypeIt, cl1),1138 ),1139 S(types.NodeTypeAfterSuite),1140 },1141 },1142 "",1143 "",1144 "{{red}}{{bold}}Summarizing 4 Failures:{{/}}",1145 " {{red}}[FAIL]{{/}} {{/}}Describe A {{gray}}{{red}}{{bold}}Context B [JustBeforeEach]{{/}} {{/}}The Test{{/}} {{coral}}[cat, dog, fish, giraffe]{{/}}",1146 " {{gray}}"+cl4.String()+"{{/}}",1147 " {{magenta}}[PANICKED!]{{/}} {{/}}Describe A {{gray}}{{magenta}}{{bold}}[It] The Test{{/}}{{/}}",1148 " {{gray}}"+cl2.String()+"{{/}}",1149 " {{orange}}[INTERRUPTED]{{/}} {{/}}{{orange}}{{bold}}[It] The Test{{/}}{{/}}",1150 " {{gray}}"+cl1.String()+"{{/}}",1151 " {{coral}}[ABORTED]{{/}} {{/}}{{coral}}{{bold}}[It] The Test{{/}}{{/}}",1152 " {{gray}}"+cl1.String()+"{{/}}",1153 "",1154 "{{red}}{{bold}}Ran 9 of 13 Specs in 60.000 seconds{{/}}",1155 "{{red}}{{bold}}FAIL!{{/}} -- {{green}}{{bold}}5 Passed{{/}} | {{red}}{{bold}}4 Failed{{/}} | {{light-yellow}}{{bold}}2 Flaked{{/}} | {{yellow}}{{bold}}2 Pending{{/}} | {{cyan}}{{bold}}3 Skipped{{/}}",1156 "",1157 ),1158 Entry("the suite fails with failed suite setups",1159 C(),1160 types.Report{1161 SuiteSucceeded: false,1162 PreRunStats: types.PreRunStats{TotalSpecs: 10, SpecsThatWillRun: 5},1163 RunTime: time.Minute,1164 SpecReports: types.SpecReports{1165 S(types.NodeTypeBeforeSuite, cl0, types.SpecStateFailed, 2,1166 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeIsLeafNode, FailureNodeLocation(cl0), types.NodeTypeBeforeSuite, 1, cl1),1167 ),1168 S(types.NodeTypeAfterSuite, cl2, types.SpecStateFailed, 2,1169 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeIsLeafNode, FailureNodeLocation(cl2), types.NodeTypeAfterSuite, 1, cl3),1170 ),1171 S(types.NodeTypeReportAfterSuite, "my report", cl1, types.SpecStateFailed, 2,1172 F("FAILURE MESSAGE\nWITH DETAILS", types.FailureNodeIsLeafNode, FailureNodeLocation(cl3), types.NodeTypeReportAfterSuite, 1, cl4),1173 ),1174 },1175 },1176 "",1177 "",1178 "{{red}}{{bold}}Summarizing 3 Failures:{{/}}",1179 " {{red}}[FAIL]{{/}} {{/}}{{red}}{{bold}}[BeforeSuite] {{/}}{{/}}",1180 " {{gray}}"+cl1.String()+"{{/}}",1181 " {{red}}[FAIL]{{/}} {{/}}{{red}}{{bold}}[AfterSuite] {{/}}{{/}}",1182 " {{gray}}"+cl3.String()+"{{/}}",1183 " {{red}}[FAIL]{{/}} {{/}}{{red}}{{bold}}[ReportAfterSuite] my report{{/}}{{/}}",1184 " {{gray}}"+cl4.String()+"{{/}}",1185 "",1186 "{{red}}{{bold}}Ran 0 of 10 Specs in 60.000 seconds{{/}}",...
RE
Using AI Code Generation
1import (2func Test1(t *testing.T) {3 gomega.RegisterFailHandler(ginkgo.Fail)4 junitReporter := reporters.NewJUnitReporter("junit.xml")5 ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Test1 Suite", []ginkgo.Reporter{junitReporter})6}7var _ = ginkgo.Describe("Test1", func() {8 ginkgo.It("Should pass", func() {9 ginkgo.By("By 1")10 ginkgo.By("By 2")11 fmt.Println("Hello World")12 })13})14import (15func Test2(t *testing.T) {16 gomega.RegisterFailHandler(ginkgo.Fail)17 junitReporter := reporters.NewJUnitReporter("junit.xml")18 ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Test2 Suite", []ginkgo.Reporter{junitReporter})19}20var _ = ginkgo.Describe("Test2", func() {21 ginkgo.It("Should pass", func() {22 ginkgo.By("By 1")23 ginkgo.By("By 2")24 fmt.Println("Hello World")25 })26})27import (28func Test3(t *testing.T) {29 gomega.RegisterFailHandler(ginkgo.Fail)30 junitReporter := reporters.NewJUnitReporter("junit.xml")31 ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Test3 Suite", []ginkgo.Reporter{junitReporter})32}33var _ = ginkgo.Describe("Test3", func() {
RE
Using AI Code Generation
1import (2func TestGinkgo(t *testing.T) {3 ginkgo.RunSpecsWithCustomReporters(t, "Ginkgo", []ginkgo.Reporter{reporters.NewJUnitReporter("junit.xml")})4}5import (6func TestGinkgo(t *testing.T) {7 ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Ginkgo", []ginkgo.Reporter{reporters.NewJUnitReporter("junit.xml")})8}
RE
Using AI Code Generation
1import (2func main() {3 var re *regexp.Regexp = regexp.MustCompile("[Hh]ugo?")4 var one []string = re.FindStringSubmatch(s)5 var two []string = re.FindStringSubmatch(s)6 fmt.Println(one)7 fmt.Println(two)8}9import (10func main() {11 var re *regexp.Regexp = regexp.MustCompile("[Hh]ugo?")12 var all []string = re.FindAllString(s, -1)13 fmt.Println(all)14}15import (16func main() {17 var re *regexp.Regexp = regexp.MustCompile("[Hh]ugo?")18 var all [][]int = re.FindAllStringIndex(s, -1)19 fmt.Println(all)20}21import (22func main() {23 var re *regexp.Regexp = regexp.MustCompile("[Hh]ugo?")24 var all [][]string = re.FindAllStringSubmatch(s, -1)25 fmt.Println(all)26}27import (28func main() {29 var re *regexp.Regexp = regexp.MustCompile("[Hh]ugo?")30 var all [][]int = re.FindAllStringSubmatchIndex(s, -1)31 fmt.Println(all)32}33import (34func main() {35 var re *regexp.Regexp = regexp.MustCompile("[Hh]ugo?")
RE
Using AI Code Generation
1import (2func main() {3 fmt.Println("Enter the input string")4 fmt.Scanln(&input)5 fmt.Println("The input string is ", input)6 fmt.Println("The length of the input string is ", len(input))7 fmt.Println("The first character of the input string is ", input[0])8 fmt.Println("The last character of the input string is ", input[len(input)-1])9}10import (11func main() {12 fmt.Println("Enter the input string")13 fmt.Scanln(&input)14 fmt.Println("The input string is ", input)15 fmt.Println("The length of the input string is ", len(input))16 fmt.Println("The first character of the input string is ", input[0])17 fmt.Println("The last character of the input string is ", input[len(input)-1])18}19import (20func main() {21 fmt.Println("Enter the input string")22 fmt.Scanln(&input)23 fmt.Println("The input string is ", input)24 fmt.Println("The length of the input string is ", len(input))25 fmt.Println("The first character of the input string is ", input[0])26 fmt.Println("The last character of the input string is ", input[len(input)-1])27}
RE
Using AI Code Generation
1import (2func main() {3 r, _ := regexp.Compile("test")4 fmt.Println(r.FindString(s))5 fmt.Println(r.FindStringIndex(s))6 for _, v := range r.FindStringSubmatchIndex(s) {7 fmt.Println(v)8 }9 fmt.Println(r.FindStringSubmatch(s))10 fmt.Println(r.FindAllString(s, -1))11 fmt.Println(r.FindAllStringIndex(s, -1))12 for _, v := range r.FindAllStringSubmatchIndex(s, -1) {13 fmt.Println(v)14 }15 for _, v := range r.FindAllStringSubmatch(s, -1) {16 fmt.Println(v)17 }18 fmt.Println(r.MatchString(s))19 fmt.Println(r.FindIndex([]byte(s)))20 for _, v := range r.FindSubmatchIndex([]byte(s)) {21 fmt.Println(v)22 }23 fmt.Println(r.FindSubmatch([]byte(s)))24 fmt.Println(r.FindAll([]byte(s), -1))25 fmt.Println(r.FindAllIndex([]byte(s), -1))26 for _, v := range r.FindAllSubmatchIndex([]byte(s), -1) {27 fmt.Println(v)28 }29 for _, v := range r.FindAllSubmatch([]byte(s), -1) {30 fmt.Println(v)31 }32 fmt.Println(r.Match([]byte(s)))33 fmt.Println(r.ReplaceAllString(s, "example"))34 fmt.Println(r.ReplaceAllString(s, "example"))35 fmt.Println(r.ReplaceAllStringFunc(s,
RE
Using AI Code Generation
1func main() {2 rt := reporters_test.RE{}3 rt.SayHello()4}5func main() {6 rt := reporters_test.RE{}7 rt.SayHello()8}9func main() {10 rt := reporters_test.RE{}11 rt.SayHello()12}13func main() {14 rt := reporters_test.RE{}15 rt.SayHello()16}17func main() {18 rt := reporters_test.RE{}19 rt.SayHello()20}21func main() {22 rt := reporters_test.RE{}23 rt.SayHello()24}25func main() {26 rt := reporters_test.RE{}27 rt.SayHello()28}29func main() {30 rt := reporters_test.RE{}31 rt.SayHello()32}33func main() {34 rt := reporters_test.RE{}35 rt.SayHello()36}37func main() {
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!