Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

0.0.1

  • Loading branch information...
commit ec8209af7a44b0077ef2a7d8b3b1e8f6ffb3e98a 1 parent f49d797
@jnewland authored
View
2  .gitignore
@@ -1 +1,3 @@
examples/self_test/*
+*.gem
+pkg/*
View
28 Rakefile
@@ -5,4 +5,30 @@ begin
t.cucumber_opts = "--require features/"
end
rescue LoadError
-end
+end
+
+require 'rubygems'
+require 'rake'
+$LOAD_PATH.unshift 'lib'
+require 'cucumber/formatter/json/version'
+
+require 'jeweler'
+Jeweler::Tasks.new do |gem|
+ gem.version = Cucumber::Formatter::JSON::VERSION
+ gem.name = "cucumber-json"
+ gem.summary = %Q{A cucumber formatter that outputs JSON}
+ gem.description = %Q{A cucumber formatter that outputs JSON}
+ gem.email = "jnewland@gmail.com"
+ gem.homepage = "http://github.com/jnewland/cucumber-json"
+ gem.authors = ["Jesse Newland"]
+ gem.add_dependency "cucumber", "~> 0.6.3"
+ gem.add_dependency "json", "~> 1.2.1"
+ gem.test_files.include 'features/**/*'
+ gem.test_files.exclude 'examples/self_test/tmp/features'
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
+end
+Jeweler::GemcutterTasks.new
+
+task :cucumber => :check_dependencies
+
+task :default => :cucumber
View
63 Readme.md
@@ -0,0 +1,63 @@
+cucumber-json
+=============
+
+A [Cucumber Output Formatter](http://wiki.github.com/aslakhellesoy/cucumber/custom-formatters)
+that generates JSON.
+
+ Feature: JSON formatter
+ As a developer
+ I want to receive reports of failing cucumber features in a parsable format
+ In order to facilitace elegant continuous integration
+ In order to protect revenue
+
+Installation
+------------
+
+ gem install cucumber-json
+
+Usage
+-----
+
+In your project:
+
+ cucumber --format Cucumber::Formatter::JSON
+
+Or, to output to a file:
+
+ cucumber --format Cucumber::Formatter::JSON --out path/to/filename
+
+Parsing
+-------
+
+The JSON generated is a hash that has 3 keys:
+
+* failing_features
+ * an array of all failing features, in a format similar to the default
+ cucumber format
+* features
+ * an array of all features, in a format similar to the default cucumber
+ format
+* status_counts
+ * a hash of statuses, and the number of steps with that status
+
+Additional information could be added to this hash in the future; this is just
+what I needed at the moment.
+
+Example
+-------
+
+The output of this project's cucumber features have been run through the
+`Cucumber::Formatter::JSON` formatter and included at `examples/features.json`.
+This was generated like so:
+
+ cucumber -f Cucumber::Formatter::JSON --out examples/features.json
+
+Author
+------
+
+[Jesse Newland](http://twitter.com/jnewland)
+
+License
+-------
+
+MIT, same license as Ruby. See `LICENSE` for more details
View
62 cucumber-json.gemspec
@@ -0,0 +1,62 @@
+# Generated by jeweler
+# DO NOT EDIT THIS FILE DIRECTLY
+# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{cucumber-json}
+ s.version = "0.0.1"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Jesse Newland"]
+ s.date = %q{2010-05-19}
+ s.description = %q{A cucumber formatter that outputs JSON}
+ s.email = %q{jnewland@gmail.com}
+ s.extra_rdoc_files = [
+ "LICENSE"
+ ]
+ s.files = [
+ ".gitignore",
+ "LICENSE",
+ "Rakefile",
+ "Readme.md",
+ "cucumber-json.gemspec",
+ "examples/features.json",
+ "features/formatter.feature",
+ "features/step_definitions/cucumber_steps.rb",
+ "features/step_definitions/custom_steps.rb",
+ "features/support/env.rb",
+ "lib/cucumber/formatter/json.rb",
+ "lib/cucumber/formatter/json/version.rb"
+ ]
+ s.homepage = %q{http://github.com/jnewland/cucumber-json}
+ s.rdoc_options = ["--charset=UTF-8"]
+ s.require_paths = ["lib"]
+ s.rubygems_version = %q{1.3.6}
+ s.summary = %q{A cucumber formatter that outputs JSON}
+ s.test_files = [
+ "features/formatter.feature",
+ "features/step_definitions",
+ "features/step_definitions/cucumber_steps.rb",
+ "features/step_definitions/custom_steps.rb",
+ "features/support",
+ "features/support/env.rb"
+ ]
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<cucumber>, ["~> 0.6.3"])
+ s.add_runtime_dependency(%q<json>, ["~> 1.2.1"])
+ else
+ s.add_dependency(%q<cucumber>, ["~> 0.6.3"])
+ s.add_dependency(%q<json>, ["~> 1.2.1"])
+ end
+ else
+ s.add_dependency(%q<cucumber>, ["~> 0.6.3"])
+ s.add_dependency(%q<json>, ["~> 1.2.1"])
+ end
+end
+
View
1  examples/features.json
@@ -0,0 +1 @@
+{"failing_features":[],"features":[" Scenario:: One Failing Feature\n When I run cucumber -r ../../../lib -r features/step_definitions -f Cucumber::Formatter::JSON features/one_failure.feature\n Then the output should contain \"output['status_counts']['failed']\" set to \"1\"\n And the output should contain \"output['status_counts']['passed']\" set to \"1\"\n And the output should contain \"output['status_counts']['undefined']\" set to \"1\"\n And the output should contain \"output['status_counts']['pending']\" set to \"1\"\n And the output should contain the failing feature\n \"\"\"\n Scenario:: Failing\n Given failing # features/step_definitions/steps.rb:1\n FAIL (RuntimeError)\n ./features/step_definitions/steps.rb:2:in `/failing/'\n features/one_failure.feature:4:in `Given failing'\n\n \"\"\"\n"," Scenario:: Multiple Failing Features\n When I run cucumber -r ../../../lib -r features/step_definitions -f Cucumber::Formatter::JSON features/multiple_failures.feature\n Then the output should contain \"output['status_counts']['failed']\" set to \"3\"\n And the output should contain \"output['status_counts']['passed']\" set to \"1\"\n And the output should contain the failing feature\n \"\"\"\n Scenario:: Failing\n Given failing # features/step_definitions/steps.rb:1\n FAIL (RuntimeError)\n ./features/step_definitions/steps.rb:2:in `/failing/'\n features/multiple_failures.feature:4:in `Given failing'\n\n \"\"\"\n And the output should contain the failing feature\n \"\"\"\n Scenario:: Failing2\n Given failing # features/step_definitions/steps.rb:1\n FAIL (RuntimeError)\n ./features/step_definitions/steps.rb:2:in `/failing/'\n features/multiple_failures.feature:7:in `Given failing'\n\n \"\"\"\n And the output should contain the failing feature\n \"\"\"\n Scenario:: Failing3\n Given failing # features/step_definitions/steps.rb:1\n FAIL (RuntimeError)\n ./features/step_definitions/steps.rb:2:in `/failing/'\n features/multiple_failures.feature:10:in `Given failing'\n\n \"\"\"\n"," Scenario:: All Features Passing\n When I run cucumber -r ../../../lib -r features/step_definitions -f Cucumber::Formatter::JSON features/all_passing.feature\n Then the output should contain \"output['status_counts']['passed']\" set to \"2\"\n And the output should contain no failing features\n"],"status_counts":{"passed":35}}
Please sign in to comment.
Something went wrong with that request. Please try again.