From ca86a577d8d3c4cbcf0a9697ecea16739bcd0c97 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 3 Jan 2012 12:28:17 -0500 Subject: [PATCH] get the reporters working better and add features --- .gitignore | 2 ++ Gemfile | 4 ++++ features/junit.feature | 6 ++++++ .../step_definitions/given/i_want_to_use_reporter.rb | 4 ++++ features/step_definitions/then/it_should_succeed.rb | 3 +++ features/step_definitions/when/i_run_test_suite.rb | 3 +++ features/teamcity.feature | 6 ++++++ spec/javascripts/super_log_spec.js.coffee | 7 +++++++ spec/javascripts/support/jasmine.yml | 9 +++++++++ src/test.js | 0 .../jasmine.HeadlessReporter.JUnit.coffee | 12 ++++++++++++ .../jasmine.HeadlessReporter.Teamcity.coffee | 12 ++++++++++++ 12 files changed, 68 insertions(+) create mode 100644 features/junit.feature create mode 100644 features/step_definitions/given/i_want_to_use_reporter.rb create mode 100644 features/step_definitions/then/it_should_succeed.rb create mode 100644 features/step_definitions/when/i_run_test_suite.rb create mode 100644 features/teamcity.feature create mode 100644 spec/javascripts/super_log_spec.js.coffee create mode 100644 spec/javascripts/support/jasmine.yml create mode 100644 src/test.js diff --git a/.gitignore b/.gitignore index d87d4be..cb4aa3e 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ spec/reports test/tmp test/version_tmp tmp +.jhw-cache/ + diff --git a/Gemfile b/Gemfile index f9c5fe9..f9b4859 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,7 @@ source 'https://rubygems.org' # Specify your gem's dependencies in jasmine-headless-webkit-reporters.gemspec gemspec + +gem 'jasmine-headless-webkit', :path => '../jasmine-headless-webkit' +gem 'cucumber' +gem 'rspec' diff --git a/features/junit.feature b/features/junit.feature new file mode 100644 index 0000000..06145a8 --- /dev/null +++ b/features/junit.feature @@ -0,0 +1,6 @@ +Feature: JUnit Reporter + Scenario: + Given I want to use the "JUnit" reporter + When I run the test suite + Then it should succeed + diff --git a/features/step_definitions/given/i_want_to_use_reporter.rb b/features/step_definitions/given/i_want_to_use_reporter.rb new file mode 100644 index 0000000..e008d7f --- /dev/null +++ b/features/step_definitions/given/i_want_to_use_reporter.rb @@ -0,0 +1,4 @@ +Given /^I want to use the "([^"]*)" reporter$/ do |reporter| + @reporter = reporter +end + diff --git a/features/step_definitions/then/it_should_succeed.rb b/features/step_definitions/then/it_should_succeed.rb new file mode 100644 index 0000000..6a64b24 --- /dev/null +++ b/features/step_definitions/then/it_should_succeed.rb @@ -0,0 +1,3 @@ +Then /^it should succeed$/ do + $?.exitstatus.should == 0 +end diff --git a/features/step_definitions/when/i_run_test_suite.rb b/features/step_definitions/when/i_run_test_suite.rb new file mode 100644 index 0000000..4de915c --- /dev/null +++ b/features/step_definitions/when/i_run_test_suite.rb @@ -0,0 +1,3 @@ +When /^I run the test suite$/ do + %x{jasmine-headless-webkit -f #{@reporter}} +end diff --git a/features/teamcity.feature b/features/teamcity.feature new file mode 100644 index 0000000..e238d5a --- /dev/null +++ b/features/teamcity.feature @@ -0,0 +1,6 @@ +Feature: Teamcity Reporter + Scenario: + Given I want to use the "Teamcity" reporter + When I run the test suite + Then it should succeed + diff --git a/spec/javascripts/super_log_spec.js.coffee b/spec/javascripts/super_log_spec.js.coffee new file mode 100644 index 0000000..475c930 --- /dev/null +++ b/spec/javascripts/super_log_spec.js.coffee @@ -0,0 +1,7 @@ +describe 'Super Long Test', -> + for index in [1..10000] + describe "run #{index}", -> + it 'should succeed', -> + for check in [1..100] + expect(check).toEqual(check) + diff --git a/spec/javascripts/support/jasmine.yml b/spec/javascripts/support/jasmine.yml new file mode 100644 index 0000000..9a27bea --- /dev/null +++ b/spec/javascripts/support/jasmine.yml @@ -0,0 +1,9 @@ +src_dir: 'src' +spec_dir: 'spec/javascripts' + +src_files: +- "*.js" + +spec_files: +- "*_spec.*{js,coffee}" + diff --git a/src/test.js b/src/test.js new file mode 100644 index 0000000..e69de29 diff --git a/vendor/assets/javascripts/jasmine.HeadlessReporter.JUnit.coffee b/vendor/assets/javascripts/jasmine.HeadlessReporter.JUnit.coffee index 798f004..1ecaa78 100644 --- a/vendor/assets/javascripts/jasmine.HeadlessReporter.JUnit.coffee +++ b/vendor/assets/javascripts/jasmine.HeadlessReporter.JUnit.coffee @@ -6,3 +6,15 @@ class jasmine.HeadlessReporter.JUnit extends jasmine.JUnitXmlReporter writeFile: (filename, text) => JHW.print(@outputTarget, text) + reportSpecResults: (spec) => + JHW.ping() + super(spec) + + reportRunnerResults: (runner) => + super(runner) + + JHW.finishSuite() + + if window.JHW + window.onbeforeunload = null + diff --git a/vendor/assets/javascripts/jasmine.HeadlessReporter.Teamcity.coffee b/vendor/assets/javascripts/jasmine.HeadlessReporter.Teamcity.coffee index 2e52a6c..ad505de 100644 --- a/vendor/assets/javascripts/jasmine.HeadlessReporter.Teamcity.coffee +++ b/vendor/assets/javascripts/jasmine.HeadlessReporter.Teamcity.coffee @@ -6,3 +6,15 @@ class jasmine.HeadlessReporter.Teamcity extends jasmine.TeamcityReporter log: (text) => JHW.print(@outputTarget, text + "\n") + reportSpecResults: (spec) => + JHW.ping() + super(spec) + + reportRunnerResults: (runner) => + super(runner) + + JHW.finishSuite() + + if window.JHW + window.onbeforeunload = null +