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.

usage_formatter.feature 3.8 kB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. Feature: Usage formatter
  2. In order to see where step definitions are used
  3. Developers should be able to see a list of step definitions and their use
  4. Background:
  5. Given a file named "features/f.feature" with:
  6. """
  7. Feature: F
  8. Background: A
  9. Given A
  10. Scenario: B
  11. Given B
  12. Scenario Outline: CA
  13. Given <x>
  14. And B
  15. Examples:
  16. |x|
  17. |C|
  18. |A|
  19. Scenario: AC
  20. Given A
  21. Given C
  22. """
  23. And a file named "features/step_definitions/steps.rb" with:
  24. """
  25. Given(/A/) { }
  26. Given(/B/) { }
  27. Given(/C/) { }
  28. Given(/D/) { }
  29. """
  30. Scenario: Run with --format usage
  31. When I run `cucumber -f usage --dry-run --publish-quiet`
  32. Then it should pass with exactly:
  33. """
  34. -----------
  35. /A/ # features/step_definitions/steps.rb:1
  36. Given A # features/f.feature:3
  37. Given A # features/f.feature:12:7
  38. Given A # features/f.feature:14
  39. /B/ # features/step_definitions/steps.rb:2
  40. Given B # features/f.feature:5
  41. And B # features/f.feature:11:8
  42. And B # features/f.feature:12:8
  43. /C/ # features/step_definitions/steps.rb:3
  44. Given C # features/f.feature:11:7
  45. Given C # features/f.feature:15
  46. /D/ # features/step_definitions/steps.rb:4
  47. NOT MATCHED BY ANY STEPS
  48. 4 scenarios (4 skipped)
  49. 11 steps (11 skipped)
  50. """
  51. Scenario: Run with --expand --format usage
  52. When I run `cucumber -x -f usage --dry-run --publish-quiet`
  53. Then it should pass with exactly:
  54. """
  55. -----------
  56. /A/ # features/step_definitions/steps.rb:1
  57. Given A # features/f.feature:3
  58. Given A # features/f.feature:12:7
  59. Given A # features/f.feature:14
  60. /B/ # features/step_definitions/steps.rb:2
  61. Given B # features/f.feature:5
  62. And B # features/f.feature:11:8
  63. And B # features/f.feature:12:8
  64. /C/ # features/step_definitions/steps.rb:3
  65. Given C # features/f.feature:11:7
  66. Given C # features/f.feature:15
  67. /D/ # features/step_definitions/steps.rb:4
  68. NOT MATCHED BY ANY STEPS
  69. 4 scenarios (4 skipped)
  70. 11 steps (11 skipped)
  71. """
  72. Scenario: Run with --format stepdefs
  73. When I run `cucumber -f stepdefs --dry-run --publish-quiet`
  74. Then it should pass with exactly:
  75. """
  76. -----------
  77. /A/ # features/step_definitions/steps.rb:1
  78. /B/ # features/step_definitions/steps.rb:2
  79. /C/ # features/step_definitions/steps.rb:3
  80. /D/ # features/step_definitions/steps.rb:4
  81. NOT MATCHED BY ANY STEPS
  82. 4 scenarios (4 skipped)
  83. 11 steps (11 skipped)
  84. """
  85. Scenario: Run with --format stepdefs when some steps are undefined
  86. Given a file named "features/calculator.feature" with:
  87. """
  88. Feature: Calculator
  89. Scenario: Adding numbers
  90. When I add 4 and 5
  91. Then I should get 9
  92. """
  93. When I run `cucumber -f stepdefs features/calculator.feature`
  94. Then it should pass with:
  95. """
  96. You can implement step definitions for undefined steps with these snippets:
  97. When('I add {int} and {int}') do |int, int2|
  98. # When('I add {int} and {float}') do |int, float|
  99. # When('I add {float} and {int}') do |float, int|
  100. # When('I add {float} and {float}') do |float, float2|
  101. pending # Write code here that turns the phrase above into concrete actions
  102. end
  103. Then('I should get {int}') do |int|
  104. # Then('I should get {float}') do |float|
  105. pending # Write code here that turns the phrase above into concrete actions
  106. end
  107. """

No Description

Contributors (1)