test_metrics 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/test_metrics.rb +24 -0
  2. metadata +65 -0
@@ -0,0 +1,24 @@
1
+ require 'fileutils'
2
+
3
+ class ActiveSupport::TestCase
4
+ REPORT_FILE = 'tmp/test_metrics.csv'
5
+ setup :before_test
6
+ teardown :after_test
7
+
8
+ def before_test
9
+ @start_time = Time.now.to_f
10
+ end
11
+
12
+ def after_test
13
+ File.open(REPORT_FILE, 'a+') do |file|
14
+ file.write("#{self.class.name}, #{@method_name}, #{((Time.now.to_f - @start_time).round(2))}\n")
15
+ end
16
+ end
17
+
18
+ def self.before_all_tests
19
+ FileUtils.rm_f(REPORT_FILE) if File.exists? REPORT_FILE
20
+ FileUtils.touch(REPORT_FILE)
21
+ end
22
+ end
23
+
24
+ ActiveSupport::TestCase.before_all_tests
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: test_metrics
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 0
10
+ version: 0.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Antony Raj
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-05-23 00:00:00 Z
19
+ dependencies: []
20
+
21
+ description: simple plugin to measure time taken by test cases
22
+ email: antony.java@gmail.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - lib/test_metrics.rb
31
+ homepage: http://rubygems.org/gems/test_metrics
32
+ licenses: []
33
+
34
+ post_install_message:
35
+ rdoc_options: []
36
+
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ hash: 3
54
+ segments:
55
+ - 0
56
+ version: "0"
57
+ requirements: []
58
+
59
+ rubyforge_project:
60
+ rubygems_version: 1.8.16
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: simple plugin to measure time taken by test cases
64
+ test_files: []
65
+