You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

retry_failing_tests.feature 3.3 kB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. Feature: Retry failing tests
  2. Retry gives you a way to get through flaky tests that usually pass after a few runs.
  3. This gives a development team a way forward other than disabling a valuable test.
  4. - Specify max retry count in option
  5. - Output information to the screen
  6. - Output retry information in test report
  7. Questions:
  8. use a tag for flaky tests? Global option to retry any test that fails?
  9. Background:
  10. Given a scenario "Fails-once" that fails once, then passes
  11. And a scenario "Fails-twice" that fails twice, then passes
  12. And a scenario "Solid" that passes
  13. Scenario: Retry once, so Fails-once starts to pass
  14. Given a scenario "Fails-forever" that fails
  15. When I run `cucumber -q --retry 1 --format summary`
  16. Then it should fail with:
  17. """
  18. 4 scenarios (2 failed, 1 flaky, 1 passed)
  19. """
  20. And it should fail with:
  21. """
  22. Fails-forever
  23. Fails-forever ✗
  24. Fails-forever ✗
  25. Fails-once feature
  26. Fails-once ✗
  27. Fails-once ✓
  28. Fails-twice feature
  29. Fails-twice ✗
  30. Fails-twice ✗
  31. Solid
  32. Solid ✓
  33. """
  34. Scenario: Retry twice, so Fails-twice starts to pass too
  35. Given a scenario "Fails-forever" that fails
  36. When I run `cucumber -q --retry 2 --format summary`
  37. Then it should fail with:
  38. """
  39. 4 scenarios (1 failed, 2 flaky, 1 passed)
  40. """
  41. And it should fail with:
  42. """
  43. Fails-forever
  44. Fails-forever ✗
  45. Fails-forever ✗
  46. Fails-forever ✗
  47. Fails-once feature
  48. Fails-once ✗
  49. Fails-once ✓
  50. Fails-twice feature
  51. Fails-twice ✗
  52. Fails-twice ✗
  53. Fails-twice ✓
  54. Solid
  55. Solid ✓
  56. """
  57. Scenario: Flaky scenarios gives exit code zero in non-strict mode
  58. When I run `cucumber -q --retry 2 --format summary`
  59. Then it should pass with:
  60. """
  61. 3 scenarios (2 flaky, 1 passed)
  62. """
  63. Scenario: Flaky scenarios gives exit code zero in non-strict mode even when failing fast
  64. When I run `cucumber -q --retry 2 --fail-fast --format summary`
  65. Then it should pass with:
  66. """
  67. 3 scenarios (2 flaky, 1 passed)
  68. """
  69. Scenario: Flaky scenarios gives non-zero exit code in strict mode
  70. When I run `cucumber -q --retry 2 --format summary --strict`
  71. Then it should fail with:
  72. """
  73. Flaky Scenarios:
  74. cucumber features/fails-once_feature.feature:2
  75. cucumber features/fails-twice_feature.feature:2
  76. 3 scenarios (2 flaky, 1 passed)
  77. """
  78. Scenario: Retry each test but suspend retrying after 2 failing tests, so later tests are not retried
  79. Given a scenario "Fails-forever-1" that fails
  80. And a scenario "Fails-forever-2" that fails
  81. When I run `cucumber -q --retry 1 --retry-total 2 --format summary`
  82. Then it should fail with:
  83. """
  84. 5 scenarios (4 failed, 1 passed)
  85. """
  86. And it should fail with:
  87. """
  88. Fails-forever-1
  89. Fails-forever-1 ✗
  90. Fails-forever-1 ✗
  91. Fails-forever-2
  92. Fails-forever-2 ✗
  93. Fails-forever-2 ✗
  94. Fails-once feature
  95. Fails-once ✗
  96. Fails-twice feature
  97. Fails-twice ✗
  98. Solid
  99. Solid ✓
  100. """

No Description

Contributors (1)