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.

api_methods.feature 1.2 kB

2 years ago
12345678910111213141516171819202122232425262728293031323334353637
  1. Feature: Formatter API methods
  2. Some utility methods are provided to make it easier to write your own formatters.
  3. Here are some examples.
  4. Scenario: A formatter that uses `Cucumber::Formatter::Io#ensure_file`
  5. The ensure_file method is a little helper function that some formatters use,
  6. normally when given a CLI argument with `--out` to check that the file passed
  7. by the user actually exists.
  8. The second argument is the name of the formatter, used to print a useful
  9. error message if the file can't be created for some reason.
  10. Given a file named "features/f.feature" with:
  11. """
  12. Feature: Test
  13. Scenario: Test
  14. """
  15. And a directory named "my/special"
  16. And a file named "features/support/custom_formatter.rb" with:
  17. """
  18. require 'cucumber/formatter/io'
  19. module Cucumber
  20. module Formatter
  21. class Test
  22. include Io
  23. def initialize(config)
  24. ensure_file("my/special/output.file", "custom formatter")
  25. end
  26. end
  27. end
  28. end
  29. """
  30. When I run `cucumber features/f.feature --format Cucumber::Formatter::Test`
  31. Then it should pass

No Description

Contributors (1)