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.

named_hooks.feature 2.0 kB

2 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. Feature: Named hooks
  2. In order to spot errors easily in hooks
  3. As a developer
  4. I can give names to hooks
  5. Scenario: Hooks can be named
  6. Given a file named "features/support/env.rb" with:
  7. """
  8. Before(name: 'Named before hook') do
  9. # no-op
  10. end
  11. """
  12. And a file named "features/simple_scenario.feature" with:
  13. """
  14. Feature:
  15. Scenario:
  16. Given a step
  17. """
  18. When I run `cucumber features --publish-quiet --format message`
  19. Then the stderr should not contain anything
  20. And the output should contain NDJSON with key "name" and value "Named before hook"
  21. Scenario: All kind of hooks can be named
  22. Given a file named "features/support/env.rb" with:
  23. """
  24. Before(name: 'Named before hook') {}
  25. After(name: 'Named after hook') {}
  26. BeforeAll(name: 'Named before_all hook') {}
  27. AfterAll(name: 'Named after_all hook') {}
  28. AfterStep(name: 'Named after_step hook') {}
  29. Around(name: 'Named around hook') {}
  30. InstallPlugin(name: 'Named install_plugin hook') {}
  31. """
  32. And a file named "features/simple_scenario.feature" with:
  33. """
  34. Feature:
  35. Scenario:
  36. Given a step
  37. """
  38. When I run `cucumber features --publish-quiet --format message`
  39. Then the stderr should not contain anything
  40. And the output should contain NDJSON with key "name" and value "Named before hook"
  41. And the output should contain NDJSON with key "name" and value "Named after hook"
  42. And the output should contain NDJSON with key "name" and value "Named before_all hook"
  43. And the output should contain NDJSON with key "name" and value "Named after_all hook"
  44. And the output should contain NDJSON with key "name" and value "Named after_step hook"
  45. And the output should contain NDJSON with key "name" and value "Named around hook"
  46. And the output should contain NDJSON with key "name" and value "Named install_plugin hook"

No Description

Contributors (1)