Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
forked cucumber_timing_presenter, refactored and began to start work on new way to present.
- Loading branch information
0 parents
commit 188981d
Showing
33 changed files
with
1,264 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
lib/**/*.rb | ||
bin/* | ||
- | ||
features/**/*.feature | ||
LICENSE.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
*.gem | ||
*.rbc | ||
.bundle | ||
.config | ||
.yardoc | ||
Gemfile.lock | ||
InstalledFiles | ||
_yardoc | ||
coverage | ||
doc/ | ||
lib/bundler/man | ||
pkg | ||
rdoc | ||
spec/reports | ||
test/tmp | ||
test/version_tmp | ||
tmp | ||
|
||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
rvm use ruby-1.9.3@cucumber_statistics --create | ||
# CI | ||
# rvm use ruby-2.0.0@dropinhq-develop --create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source 'https://rubygems.org' | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Copyright (c) 2014 AlienFast, LLC | ||
|
||
MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
----------------------------------------------------------------------------------------------------------------------- | ||
Some code originally authored by Ryan Boucher https://github.com/distributedlife/cucumber_timing_presenter | ||
|
||
Copyright (c) 2012 Ryan Boucher | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Cucumber Statistics | ||
|
||
An cucumber formatter that will gather statistics and generate a single page showing step time metrics. | ||
|
||
Work in progress: the intent is to provide a way to hook this in and always generate the file, as well as us it as a standard formatter. | ||
|
||
To use as a formatter: cucumber --format CucumberStatistics::Formatter | ||
|
||
Look in the `./tmp/cucumber_statistics` for the generated html documents. | ||
|
||
## Contributing | ||
|
||
Please contribute! | ||
|
||
1. Fork it | ||
2. Create your feature branch (`git checkout -b my-new-feature`) | ||
3. Commit your changes (`git commit -am 'Add some feature'`) | ||
4. Push to the branch (`git push origin my-new-feature`) | ||
5. Create new Pull Request | ||
|
||
## Copyright | ||
|
||
Copyright (c) 2014 AlienFast. See LICENSE.txt for further details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'bundler/gem_tasks' | ||
|
||
# add rspec task | ||
require 'rspec/core/rake_task' | ||
RSpec::Core::RakeTask.new('spec') | ||
task :default => :spec | ||
task :test => :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# coding: utf-8 | ||
lib = File.expand_path('../lib', __FILE__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
require "cucumber_statistics/version" | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = "cucumber_statistics" | ||
spec.version = CucumberStatistics::VERSION | ||
spec.authors = ["Kevin Ross"] | ||
spec.email = ["kevin.ross@alienfast.com.com"] | ||
spec.summary = <<-TEXT | ||
An cucumber formatter that will gather statistics and generate a single page showing step time metrics. | ||
TEXT | ||
spec.description = <<-TEXT | ||
Want to know what is slowing down your build? | ||
TEXT | ||
|
||
|
||
spec.homepage = "http://github.com/alienfast/cucumber_statistics" | ||
spec.license = 'MIT' | ||
|
||
spec.files = `git ls-files`.split($/).reject { |f| f =~ /^samples\// } | ||
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } | ||
spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) | ||
spec.require_paths = ['lib'] | ||
|
||
# development | ||
#spec.add_development_dependency 'cucumber' | ||
spec.add_development_dependency 'bundler', '~> 1.3' | ||
spec.add_development_dependency 'rake' | ||
spec.add_development_dependency 'rspec', '>= 2.14.1' | ||
|
||
# runtime | ||
spec.add_runtime_dependency 'awesome_print' | ||
spec.add_runtime_dependency 'cucumber' | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'cucumber_statistics/configuration' | ||
require 'cucumber_statistics/step_statistics' | ||
require 'cucumber_statistics/unused_steps' | ||
require 'cucumber_statistics/formatter' | ||
|
||
|
||
require 'cucumber_statistics/presenters/html_template' | ||
require 'cucumber_statistics/presenters/usage_record_html_presenter' | ||
require 'cucumber_statistics/presenters/all_usage_results_html_presenter' | ||
require 'cucumber_statistics/presenters/unused_steps_html_presenter' | ||
require 'cucumber_statistics/presenters/step_times_of_whole_html_presenter' | ||
require 'cucumber_statistics/presenters/step_average_and_total_html_presenter' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
require 'fileutils' | ||
|
||
module CucumberStatistics | ||
class Configuration | ||
|
||
class << self | ||
|
||
$tmp_path = 'tmp/cucumber_statistics' | ||
|
||
def clean_tmp_dir | ||
FileUtils.rm_r tmp_dir | ||
end | ||
|
||
def tmp_dir | ||
dir = resolve_path_from_root $tmp_path | ||
FileUtils.mkdir_p dir unless File.exists? dir | ||
|
||
dir | ||
end | ||
|
||
def tmp_file(filename) | ||
"#{tmp_dir}/#{filename}" | ||
end | ||
|
||
|
||
def resolve_path_from_root(relative_path) | ||
if defined?(Rails) | ||
Rails.root.join(relative_path) | ||
elsif defined?(Rake.original_dir) | ||
File.expand_path(relative_path, Rake.original_dir) | ||
else | ||
File.expand_path(relative_path, Dir.pwd) | ||
end | ||
end | ||
|
||
def all_usage_results | ||
File.expand_path('templates/all_usage_results.html', File.dirname(__FILE__)) | ||
end | ||
|
||
def unused_steps | ||
File.expand_path('templates/unused_steps.html', File.dirname(__FILE__)) | ||
end | ||
|
||
def step_times_of_whole | ||
File.expand_path('templates/step_times_of_whole.html', File.dirname(__FILE__)) | ||
end | ||
|
||
def step_average_and_total | ||
File.expand_path('templates/step_average_and_total.html', File.dirname(__FILE__)) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module CucumberStatistics | ||
class Formatter | ||
def initialize(step_mother, io, options) | ||
@step_mother = step_mother | ||
@io = io | ||
@options = options | ||
|
||
@step_statistics = StepStatistics.new | ||
@unused_steps = UnusedSteps.new | ||
end | ||
|
||
#call backs | ||
def before_step(step) | ||
@start_time = Time.now | ||
end | ||
|
||
def before_step_result(*args) | ||
@duration = Time.now - @start_time | ||
end | ||
|
||
def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line) | ||
|
||
step_definition = step_match.step_definition | ||
unless step_definition.nil? # nil if it's from a scenario outline | ||
@step_statistics.record step_definition.regexp_source, @duration | ||
end | ||
end | ||
|
||
def after_features(features) | ||
|
||
# gather unused steps | ||
@step_mother.unmatched_step_definitions.each do |step_definition| | ||
@unused_steps.record step_definition.regexp_source, step_definition.file_colon_line | ||
end | ||
|
||
@step_statistics.calculate | ||
|
||
AllUsageResultsHtmlPresenter.new @step_statistics | ||
UnusedStepsHtmlPresenter.new @unused_steps | ||
StepAverageAndTotalHtmlPresenter.new @step_statistics | ||
StepTimesOfWholeHtmlPresenter.new @step_statistics | ||
end | ||
end | ||
end |
Oops, something went wrong.