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.

profiles.feature 4.4 kB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. Feature: Profiles
  2. In order to save time and prevent carpal tunnel syndrome
  3. Cucumber users can save and reuse commonly used cucumber flags in a 'cucumber.yml' file.
  4. These named arguments are called profiles and the yml file should be in the root of your project.
  5. Any cucumber argument is valid in a profile. To see all the available flags type 'cucumber --help'
  6. For more information about profiles please see the wiki:
  7. http://wiki.github.com/cucumber/cucumber/cucumber.yml
  8. Background: Basic App
  9. Given a file named "features/sample.feature" with:
  10. """
  11. Feature: Sample
  12. Scenario: this is a test
  13. Given this step raises an error
  14. """
  15. And an empty file named "features/support/env.rb"
  16. And an empty file named "features/support/super_env.rb"
  17. And the following profiles are defined:
  18. """
  19. default: features/sample.feature --require features/support/env.rb -v
  20. super: features/sample.feature --require features/support/super_env.rb -v
  21. """
  22. Scenario: Explicitly defining a profile to run
  23. When I run `cucumber features/sample.feature --profile super`
  24. Then the output should contain:
  25. """
  26. Using the super profile...
  27. """
  28. And exactly these files should be loaded: features/support/super_env.rb
  29. Scenario: Explicitly defining a profile defined in an ERB formatted file
  30. Given the following profiles are defined:
  31. """
  32. <% requires = "--require features/support/super_env.rb" %>
  33. super: <%= "features/sample.feature #{requires} -v" %>
  34. """
  35. When I run `cucumber features/sample.feature --profile super`
  36. Then the output should contain:
  37. """
  38. Using the super profile...
  39. """
  40. And exactly these files should be loaded: features/support/super_env.rb
  41. Scenario: Defining multiple profiles to run
  42. When I run `cucumber features/sample.feature --profile default --profile super`
  43. Then the output should contain:
  44. """
  45. Using the default and super profiles...
  46. """
  47. And exactly these files should be loaded: features/support/env.rb, features/support/super_env.rb
  48. Scenario: Arguments passed in but no profile specified
  49. When I run `cucumber -v`
  50. Then the default profile should be used
  51. And exactly these files should be loaded: features/support/env.rb
  52. Scenario: Trying to use a missing profile
  53. When I run `cucumber -p foo`
  54. Then the stderr should contain:
  55. """
  56. Could not find profile: 'foo'
  57. Defined profiles in cucumber.yml:
  58. * default
  59. * super
  60. """
  61. Scenario Outline: Disabling the default profile
  62. When I run `cucumber -v features/ <flag>`
  63. Then the output should contain:
  64. """
  65. Disabling profiles...
  66. """
  67. And exactly these files should be loaded: features/support/env.rb, features/support/super_env.rb
  68. Examples:
  69. | flag |
  70. | -P |
  71. | --no-profile |
  72. Scenario: Overriding the profile's features to run
  73. Given a file named "features/another.feature" with:
  74. """
  75. Feature: Just this one should be run
  76. """
  77. When I run `cucumber -p default features/another.feature`
  78. Then exactly these features should be run: features/another.feature
  79. Scenario: Overriding the profile's formatter
  80. You will most likely want to define a formatter in your default formatter.
  81. However, you often want to run your features with a different formatter
  82. yet still use the other the other arguments in the profile. Cucumber will
  83. allow you to do this by giving precedence to the formatter specified on the
  84. command line and override the one in the profile.
  85. Given the following profiles are defined:
  86. """
  87. default: features/sample.feature --require features/support/env.rb -v --format profile
  88. """
  89. When I run `cucumber features --format pretty`
  90. Then the output should contain:
  91. """
  92. Feature: Sample
  93. """
  94. Scenario Outline: Showing profiles when listing failing scenarios
  95. Given the standard step definitions
  96. When I run `cucumber -q -p super -p default -f <format> features/sample.feature --require features/step_definitions/steps.rb`
  97. Then it should fail with:
  98. """
  99. cucumber -p super features/sample.feature:2
  100. """
  101. Examples:
  102. | format |
  103. | pretty |
  104. | progress |

No Description

Contributors (1)