dtpformatter 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NWFmMGQyZjhmOGIyNzUxNjRkNmE4OTJkNjVlZDNhOWQwMDU4Y2ViMw==
5
+ data.tar.gz: !binary |-
6
+ N2Y0ZjQxMjU4MTcwNjhhNTVkNGY3ZDIxMGQ2MjczNTQ3ZGViYzNkYw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YzJjMzBhNDlhYmQzYThhZjdiMTExZTU3N2U4NGY5ZWUwMmY2ODdjNThmYTE4
10
+ MjFlYmY3ZjhmMzk1NzZlOWUyZDdlNzcyYmNlY2QzMmYwNTExNjUyZWUzMzFk
11
+ MGE2NzAwODQzMWMxMTc5ZjBkMGZjMzZmODY5M2U0MzA2MDE5ZDQ=
12
+ data.tar.gz: !binary |-
13
+ OGEwYjM4MjgzZjc3Mzc1N2VlMGYxYTE4M2QxODE2OTcyMjc2NWRhMjJkMzky
14
+ Njk4NmIzMjU4YTNlZWUxYjc1NzhmZjg1YjUyNmFlYTczOGVkMjBmZTViMzk1
15
+ NGE2Yjc5YThmZGUyYmIxMjQyYjQ1ZWQ3MjM2YTRhYWIxMWU5Mzc=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://200.200.0.35'
2
+
3
+ # Specify your gem's dependencies in dtpformatter.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 xhb
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "dtpformatter"
7
+ spec.version = "1.0.0"
8
+ spec.authors = ["xhb"]
9
+ spec.email = ["programstart@163.com"]
10
+ spec.description = %q{use for recording dtp_workload case performance data}
11
+ spec.summary = %q{use for recording dtp_workload case performance data}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "rake"
22
+
23
+ spec.add_development_dependency "rspec", "~> 2.0"
24
+ spec.add_development_dependency "rspec-core", "!= 2.12.0"
25
+
26
+ end
data/example/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --format Dtpformatter
3
+ --out test.txt
4
+
@@ -0,0 +1,27 @@
1
+ require "spec_helper"
2
+
3
+ describe "some example specs" do
4
+ it "should succeed" do
5
+ true.should be_true
6
+ end
7
+
8
+ it "should fail" do
9
+ false.should be_true
10
+ end
11
+
12
+ it "should raise" do
13
+ raise ArgumentError
14
+ end
15
+
16
+ it "should be pending" do
17
+ pending
18
+ end
19
+
20
+ after :each, :attachment do
21
+ example.execution_result[:attachments] ||= []
22
+ example.execution_result[:attachments] << __FILE__
23
+ end
24
+
25
+ it "should have an attachment", :attachment do
26
+ end
27
+ end
@@ -0,0 +1,17 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+
12
+ # Run specs in random order to surface order dependencies. If you find an
13
+ # order dependency and want to debug it, you can fix the order by providing
14
+ # the seed, which is printed after each run.
15
+ # --seed 1234
16
+ config.order = 'random'
17
+ end
data/example/test.txt ADDED
@@ -0,0 +1,24 @@
1
+ ------Summary------
2
+ Tests: 5...Failures: 2...Total_time:0.006000...Timestamp: 2014-05-19T20:31:08+08:00
3
+ ------Details-------
4
+ ------------------
5
+ usercase: some example specs should succeed......time: 0.004000
6
+ ------------------
7
+ usercase: some example specs should fail......time: -1
8
+ exception:
9
+ expected: true value
10
+ got: false
11
+ backtrace:
12
+ ./spec/example_spec.rb:9:in `block (2 levels) in <top (required)>'
13
+
14
+ ------------------
15
+ usercase: some example specs should be pending......time: 0
16
+ ------------------
17
+ usercase: some example specs should raise......time: -1
18
+ exception:
19
+ ArgumentError
20
+ backtrace:
21
+ ./spec/example_spec.rb:13:in `block (2 levels) in <top (required)>'
22
+
23
+ ------------------
24
+ usercase: some example specs should have an attachment......time: 0.000000
@@ -0,0 +1,8 @@
1
+ require 'builder'
2
+ require 'rspec'
3
+
4
+ require 'rspec/core/formatters/base_formatter'
5
+ require 'rspec/core/formatters/dtp_formatter'
6
+
7
+ # Make it easier to use
8
+ Dtpformatter = RSpec::Core::Formatters::Dtpformatter
@@ -0,0 +1,58 @@
1
+ require 'time'
2
+
3
+ class RSpec::Core::Formatters::Dtpformatter < RSpec::Core::Formatters::BaseFormatter
4
+
5
+ def report(key, value)
6
+ if output == STDOUT
7
+ output << "usercase: #{key}......time: #{value}\n"
8
+ else
9
+ output << "usercase: #{key}......time: #{value}\n"
10
+
11
+ dtp_path = ENV["DTPDIR"].split(";")[0]
12
+
13
+ report_exe = "#{dtp_path}\\bin\\report.exe"
14
+
15
+ flag = FileTest::exist?(report_exe)
16
+ if flag == true
17
+ system("#{report_exe} --perf --table db_case_run --key \"#{key}\" --value \'#{value}\'")
18
+ else
19
+ output << "can't find report.exe to record performence result\n"
20
+ end
21
+ end
22
+ end
23
+
24
+ def start example_count
25
+ @start = Time.now
26
+ super
27
+ end
28
+
29
+ def dump_summary duration, example_count, failure_count, pending_count
30
+ super
31
+ output << "------Summary------\n"
32
+ output << "Tests: #{example_count}...Failures: #{failure_count}...Total_time:#{'%.6f' % duration}...Timestamp: #{@start.iso8601}\n"
33
+ output << "------Details-------\n"
34
+ examples.each do |example|
35
+ output << "------------------\n"
36
+ send :"dump_summary_example_#{example.execution_result[:status]}", example
37
+ end
38
+ end
39
+
40
+ def dump_summary_example_passed example
41
+ report(example.full_description, '%.6f' % example.execution_result[:run_time])
42
+ end
43
+
44
+ def dump_summary_example_pending example
45
+ report(example.full_description, "0")
46
+ end
47
+
48
+ def dump_summary_example_failed example
49
+ exception = example.execution_result[:exception]
50
+ backtrace = format_backtrace exception.backtrace, example
51
+ report(example.full_description, "-1")
52
+ output << "exception:\n\t#{exception.message}\nbacktrace:\n\t#{backtrace.join("\n")}\n\n"
53
+ end
54
+
55
+ def example_classname example
56
+ example.file_path.sub(%r{\.[^/]*\Z}, "").gsub("/", ".").gsub(%r{\A\.+|\.+\Z}, "")
57
+ end
58
+ end
data/readme.md ADDED
File without changes
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dtpformatter
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - xhb
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-core
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '!='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.12.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '!='
67
+ - !ruby/object:Gem::Version
68
+ version: 2.12.0
69
+ description: use for recording dtp_workload case performance data
70
+ email:
71
+ - programstart@163.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - dtpformatter.gemspec
82
+ - example/.rspec
83
+ - example/spec/example_spec.rb
84
+ - example/spec/spec_helper.rb
85
+ - example/test.txt
86
+ - lib/dtpformatter.rb
87
+ - lib/rspec/core/formatters/dtp_formatter.rb
88
+ - readme.md
89
+ homepage: ''
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.2.2
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: use for recording dtp_workload case performance data
113
+ test_files: []