How to use WillRun method of test_helpers Package

Best Ginkgo code snippet using test_helpers.WillRun

default_reporter_test.go

Source:default_reporter_test.go Github

copy

Full Screen

...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{{/}}",1187 "{{red}}{{bold}}FAIL!{{/}} -- {{cyan}}{{bold}}A BeforeSuite node failed so all tests were skipped.{{/}}",1188 "",1189 ),1190 Entry("when the suite includes a special failure reason",1191 C(),1192 types.Report{1193 SuiteSucceeded: false,1194 SpecialSuiteFailureReasons: []string{"Detected pending specs and --fail-on-pending is set"},1195 SuiteConfig: types.SuiteConfig{FailOnPending: true},1196 PreRunStats: types.PreRunStats{TotalSpecs: 5, SpecsThatWillRun: 3},1197 RunTime: time.Minute,1198 SpecReports: types.SpecReports{1199 S(types.SpecStatePassed), S(types.SpecStatePassed), S(types.SpecStatePassed),1200 S(types.SpecStatePending), S(types.SpecStatePending),1201 },1202 },1203 "",1204 "{{red}}{{bold}}Ran 3 of 5 Specs in 60.000 seconds{{/}}",1205 "{{red}}{{bold}}FAIL! - Detected pending specs and --fail-on-pending is set{{/}} -- {{green}}{{bold}}3 Passed{{/}} | {{red}}{{bold}}0 Failed{{/}} | {{yellow}}{{bold}}2 Pending{{/}} | {{cyan}}{{bold}}0 Skipped{{/}}",1206 "",1207 ),1208 Entry("when the suite includes multiple special failure reasons",1209 C(),1210 types.Report{1211 SuiteSucceeded: false,1212 SpecialSuiteFailureReasons: []string{"Detected pending specs and --fail-on-pending is set", "Interrupted by Timeout"},1213 SuiteConfig: types.SuiteConfig{FailOnPending: true},1214 PreRunStats: types.PreRunStats{TotalSpecs: 5, SpecsThatWillRun: 3},1215 RunTime: time.Minute,1216 SpecReports: types.SpecReports{1217 S(types.SpecStatePassed), S(types.SpecStatePassed), S(types.SpecStatePassed),1218 S(types.SpecStatePending), S(types.SpecStatePending),1219 },1220 },1221 "",1222 "{{red}}{{bold}}Ran 3 of 5 Specs in 60.000 seconds{{/}}",1223 "{{red}}{{bold}}FAIL! - Detected pending specs and --fail-on-pending is set, Interrupted by Timeout{{/}}",1224 "{{green}}{{bold}}3 Passed{{/}} | {{red}}{{bold}}0 Failed{{/}} | {{yellow}}{{bold}}2 Pending{{/}} | {{cyan}}{{bold}}0 Skipped{{/}}",1225 "",1226 ),1227 )1228})...

Full Screen

Full Screen

fake_reporter.go

Source:fake_reporter.go Github

copy

Full Screen

...69}70func (r *FakeReporter) SuiteWillBegin(report types.Report) {71 r.Begin = report72}73func (r *FakeReporter) WillRun(report types.SpecReport) {74 r.Will = append(r.Will, report)75}76func (r *FakeReporter) DidRun(report types.SpecReport) {77 r.Did = append(r.Did, report)78}79func (r *FakeReporter) SuiteDidEnd(report types.Report) {80 r.End = report81}82type NSpecs int83type NWillRun int84type NPassed int85type NSkipped int86type NFailed int87type NPending int88type NFlaked int89func BeASuiteSummary(options ...interface{}) OmegaMatcher {90 type ReportStats struct {91 Succeeded bool92 TotalSpecs int93 WillRunSpecs int94 Passed int95 Skipped int96 Failed int97 Pending int98 Flaked int99 }100 fields := Fields{101 "Passed": Equal(0),102 "Skipped": Equal(0),103 "Failed": Equal(0),104 "Pending": Equal(0),105 "Flaked": Equal(0),106 "TotalSpecs": Equal(0),107 }108 for _, option := range options {109 t := reflect.TypeOf(option)110 if t.Kind() == reflect.Bool {111 if option.(bool) {112 fields["Succeeded"] = BeTrue()113 } else {114 fields["Succeeded"] = BeFalse()115 }116 } else if t == reflect.TypeOf(NSpecs(0)) {117 fields["TotalSpecs"] = Equal(int(option.(NSpecs)))118 } else if t == reflect.TypeOf(NWillRun(0)) {119 fields["WillRunSpecs"] = Equal(int(option.(NWillRun)))120 } else if t == reflect.TypeOf(NPassed(0)) {121 fields["Passed"] = Equal(int(option.(NPassed)))122 } else if t == reflect.TypeOf(NSkipped(0)) {123 fields["Skipped"] = Equal(int(option.(NSkipped)))124 } else if t == reflect.TypeOf(NFailed(0)) {125 fields["Failed"] = Equal(int(option.(NFailed)))126 } else if t == reflect.TypeOf(NPending(0)) {127 fields["Pending"] = Equal(int(option.(NPending)))128 } else if t == reflect.TypeOf(NFlaked(0)) {129 fields["Flaked"] = Equal(int(option.(NFlaked)))130 }131 }132 return WithTransform(func(report types.Report) ReportStats {133 specs := report.SpecReports.WithLeafNodeType(types.NodeTypeIt)134 return ReportStats{135 Succeeded: report.SuiteSucceeded,136 TotalSpecs: report.PreRunStats.TotalSpecs,137 WillRunSpecs: report.PreRunStats.SpecsThatWillRun,138 Passed: specs.CountWithState(types.SpecStatePassed),139 Skipped: specs.CountWithState(types.SpecStateSkipped),140 Failed: specs.CountWithState(types.SpecStateFailureStates),141 Pending: specs.CountWithState(types.SpecStatePending),142 Flaked: specs.CountOfFlakedSpecs(),143 }144 }, MatchFields(IgnoreExtras, fields))145}146type CapturedGinkgoWriterOutput string147type CapturedStdOutput string148type NumAttempts int149func HavePassed(options ...interface{}) OmegaMatcher {150 matchers := []OmegaMatcher{151 HaveField("State", types.SpecStatePassed),...

Full Screen

Full Screen

WillRun

Using AI Code Generation

copy

Full Screen

1func TestMain(m *testing.M) {2 test_helpers.WillRun(m, "TestMain")3}4func TestMain(m *testing.M) {5 test_helpers.WillRun(m, "TestMain")6}7func TestMain(m *testing.M) {8 test_helpers.WillRun(m, "TestMain")9}10func TestMain(m *testing.M) {11 test_helpers.WillRun(m, "TestMain")12}13func TestMain(m *testing.M) {14 test_helpers.WillRun(m, "TestMain")15}16func TestMain(m *testing.M) {17 test_helpers.WillRun(m, "TestMain")18}19func TestMain(m *testing.M) {20 test_helpers.WillRun(m, "TestMain")21}22func TestMain(m *testing.M) {23 test_helpers.WillRun(m, "TestMain")24}25func TestMain(m *testing.M) {26 test_helpers.WillRun(m, "TestMain")27}28func TestMain(m *testing.M) {29 test_helpers.WillRun(m, "TestMain")30}31func TestMain(m *testing.M) {32 test_helpers.WillRun(m, "TestMain")33}34func TestMain(m *testing.M) {35 test_helpers.WillRun(m, "TestMain")36}37func TestMain(m *testing

Full Screen

Full Screen

WillRun

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello World")4 test_helpers.WillRun()5}6import "fmt"7func WillRun() {8 fmt.Println("I will run")9}

Full Screen

Full Screen

WillRun

Using AI Code Generation

copy

Full Screen

1func TestMain(m *testing.M) {2 test_helpers.WillRun(m, "TestMain")3}4func TestMain1(m *testing.M) {5 test_helpers.WillRun(m, "TestMain1")6}7func TestMain2(m *testing.M) {8 test_helpers.WillRun(m, "TestMain2")9}10func TestMain3(m *testing.M) {11 test_helpers.WillRun(m, "TestMain3")12}13func TestMain4(m *testing.M) {14 test_helpers.WillRun(m, "TestMain4")15}16func TestMain5(m *testing.M) {17 test_helpers.WillRun(m, "TestMain5")18}19func TestMain6(m *testing.M) {20 test_helpers.WillRun(m, "TestMain6")21}22func TestMain7(m *testing.M) {23 test_helpers.WillRun(m, "TestMain7")24}25func TestMain8(m *testing.M) {26 test_helpers.WillRun(m, "TestMain8")27}28func TestMain9(m *testing.M) {29 test_helpers.WillRun(m, "TestMain9")30}31func TestMain10(m *testing.M) {32 test_helpers.WillRun(m, "TestMain10")33}34func TestMain11(m *testing.M) {35 test_helpers.WillRun(m, "TestMain11")36}

Full Screen

Full Screen

WillRun

Using AI Code Generation

copy

Full Screen

1import (2func TestMain(m *testing.M) {3 test_helpers.WillRun()4 m.Run()5}6func TestHome(t *testing.T) {7 response := test_helpers.Get("/")8 status := test_helpers.Status(response)9 body := test_helpers.Body(response)10 test_helpers.Assert(status, body, "200", "Hello World!")11}12func Test404(t *testing.T) {13 response := test_helpers.Get("/notfound")14 status := test_helpers.Status(response)15 body := test_helpers.Body(response)16 test_helpers.Assert(status, body, "404", "page not found")17}18import (19func WillRun() {20 beego.TestBeegoInit("conf/app.conf")21}22func Get(url string) *httptest.ResponseRecorder {23 req, err := http.NewRequest("GET", url, strings.NewReader(""))24 if err != nil {25 panic(err)26 }27 w := httptest.NewRecorder()28 beego.BeeApp.Handlers.ServeHTTP(w, req)29}30func Status(response *httptest

Full Screen

Full Screen

WillRun

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello World")4 test_helpers.WillRun()5}6import "fmt"7func WillRun() {8 fmt.Println("I will run")9}10func TestSum(t *testing.T) {11 numbers := []int{1, 2, 3, 4, 5}12 got := Sum(numbers)13 if got != want {14 t.Errorf("got %d want %d given, %v", got, want, numbers)15 }16}17func Sum(numbers []int) int {18}19func TestSum(t *testing.T) {20 numbers := []int{1, 2, 3, 4, 5}21 got := Sum(numbers)22 if got != want {23 t.Errorf("got %d want %d given, %v", got, want, numbers)24 }25}26func Sum(numbers []int) int {27 for _, number := range numbers {28 }29}30func TestSum(t *testing.T) {31 numbers := []int{1, 2, 3, 4, 5}32 got := Sum(numbers)33 if got != want {34 t.Errorf("

Full Screen

Full Screen

WillRun

Using AI Code Generation

copy

Full Screen

1import (2func TestWillRun(t *testing.T) {3 test_helpers.WillRun(t)4}5import (6func TestWillRun(t *testing.T) {7 test_helpers.WillRun(t)8}9import (10func TestWillRun(t *testing.T) {11 test_helpers.WillRun(t)12}13import (14func TestWillRun(t *testing.T) {15 test_helpers.WillRun(t)16}17import (18func TestWillRun(t *testing.T) {19 test_helpers.WillRun(t)20}21import (22func TestWillRun(t *testing.T) {23 test_helpers.WillRun(t)24}25import (26func TestWillRun(t *testing.T) {27 test_helpers.WillRun(t)28}29import (30func TestWillRun(t *testing.T) {31 test_helpers.WillRun(t)32}33import (34func TestWillRun(t *testing.T) {35 test_helpers.WillRun(t)36}37import (38func TestWillRun(t *testing.T) {39 test_helpers.WillRun(t)40}41import (42func TestWillRun(t *testing.T) {43 test_helpers.WillRun(t)

Full Screen

Full Screen

WillRun

Using AI Code Generation

copy

Full Screen

1import (2func TestMySuite(t *testing.T) {3 test_helpers.WillRun = func() {4 }5 RunSpecs(t, "MySuite")6}7import (8func TestMySuite2(t *testing.T) {9 test_helpers.WillRun = func() {10 }11 RunSpecs(t, "MySuite2")12}13import (14func TestMySuite3(t *testing.T) {15 test_helpers.WillRun = func() {16 }17 RunSpecs(t, "MySuite3")18}19import (20func TestMySuite4(t *testing.T) {21 test_helpers.WillRun = func() {22 }23 RunSpecs(t, "MySuite4")24}25import (26func TestMySuite5(t *testing.T) {27 test_helpers.WillRun = func() {28 }29 RunSpecs(t, "MySuite5")30}31import (

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful