keeptesting 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/keeptesting +6 -16
- data/keeptesting.gemspec +3 -4
- data/lib/keeptesting.rb +1 -2
- data/lib/keeptesting/cli.rb +12 -4
- data/lib/keeptesting/version.rb +1 -1
- data/todo.org +18 -14
- metadata +95 -75
- data/webconsole.html +0 -89
- data/webconsole.rb +0 -16
data/bin/keeptesting
CHANGED
@@ -31,8 +31,7 @@ keeptesting -p 'test' -p 'lib' -c 'Error|Failure' 'rake test' Test on changes i
|
|
31
31
|
keeptesting -d 'Error|Failure' 'rake test' Store current config in .keeptesting
|
32
32
|
keeptesting Run using .keeptesting config file
|
33
33
|
|
34
|
-
-
|
35
|
-
-p, --watched-path Path to watch for changes
|
34
|
+
-p, --watched-path Path to watch for changes
|
36
35
|
-d, --store-dotfile Save current keeptesting config in dotfile
|
37
36
|
-h, --help Display usage
|
38
37
|
-v, --version Display version number
|
@@ -47,7 +46,7 @@ def parse_options
|
|
47
46
|
if ARGV.size == 0
|
48
47
|
return YAML.load(File.read(".keeptesting"))
|
49
48
|
end
|
50
|
-
|
49
|
+
|
51
50
|
ARGV.each do |arg|
|
52
51
|
if arg == "-v" || arg == "--version"
|
53
52
|
puts Keeptesting::VERSION; exit
|
@@ -62,12 +61,8 @@ def parse_options
|
|
62
61
|
|
63
62
|
options[:failure_regex] = ARGV[ARGV.size-2]
|
64
63
|
options[:test_command] = ARGV[ARGV.size-1]
|
65
|
-
|
64
|
+
|
66
65
|
ARGV.each_with_index do |arg, i|
|
67
|
-
if arg == "-c" || arg == "--command-line-mode"
|
68
|
-
options[:cli_mode] = true
|
69
|
-
end
|
70
|
-
|
71
66
|
if arg == "-p" || arg == "--watched-path"
|
72
67
|
options[:watched_paths] ||= []
|
73
68
|
options[:watched_paths] << ARGV[i+1]
|
@@ -78,20 +73,15 @@ def parse_options
|
|
78
73
|
options[:watched_paths] == ["**/*"]
|
79
74
|
end
|
80
75
|
|
81
|
-
if ARGV.include?("-d") || ARGV.include?("--store-dotfile")
|
76
|
+
if ARGV.include?("-d") || ARGV.include?("--store-dotfile")
|
82
77
|
File.open(".keeptesting", "w+") do |f|
|
83
78
|
f.write(YAML::dump(options))
|
84
79
|
end
|
85
80
|
end
|
86
|
-
|
81
|
+
|
87
82
|
return options
|
88
83
|
end
|
89
84
|
|
90
85
|
|
91
86
|
options = parse_options
|
92
|
-
|
93
|
-
if options[:cli_mode]
|
94
|
-
Keeptesting::CLI::start_test_loop(options)
|
95
|
-
else
|
96
|
-
Keeptesting::BrowserConsole.new(options)
|
97
|
-
end
|
87
|
+
Keeptesting::CLI::start_test_loop(options)
|
data/keeptesting.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.authors = ["Thomas Kjeldahl Nilsson"]
|
9
9
|
s.email = ["thomas@kjeldahlnilsson.net"]
|
10
10
|
s.homepage = "https://github.com/thomanil/keeptesting"
|
11
|
-
s.summary = %q{A
|
11
|
+
s.summary = %q{A platform/language agnostic autotest tool}
|
12
12
|
s.description = %q{Usage: keeptesting [options] TESTCOMMAND}
|
13
13
|
|
14
14
|
s.rubyforge_project = "keeptesting"
|
@@ -21,10 +21,9 @@ Gem::Specification.new do |s|
|
|
21
21
|
# specify any dependencies here; for example:
|
22
22
|
# s.add_development_dependency "rspec"
|
23
23
|
s.add_runtime_dependency "fssm"
|
24
|
-
|
25
|
-
|
24
|
+
|
26
25
|
s.add_development_dependency "mocha"
|
27
26
|
s.add_development_dependency "minitest"
|
28
27
|
s.add_development_dependency "shoulda"
|
29
|
-
s.add_development_dependency "shoulda-context"
|
28
|
+
s.add_development_dependency "shoulda-context"
|
30
29
|
end
|
data/lib/keeptesting.rb
CHANGED
data/lib/keeptesting/cli.rb
CHANGED
@@ -8,23 +8,31 @@ module Keeptesting
|
|
8
8
|
RED_TEXT="\033[31m"
|
9
9
|
RESET_TEXT="\033[0m"
|
10
10
|
|
11
|
-
|
11
|
+
|
12
12
|
def self.testrun(options)
|
13
13
|
puts `clear`
|
14
14
|
puts "#{YELLOW_TEXT}RUNNING TESTS...#{RESET_TEXT}"
|
15
|
-
|
15
|
+
Keeptesting::CLI::colorize_emacs_modeline("Black", "Gold")
|
16
|
+
|
16
17
|
cmd = options[:test_command]
|
17
18
|
test_output = `#{cmd} 2>&1`
|
18
19
|
test_succeded = Keeptesting::Common::test_success?(test_output, options[:failure_regex])
|
19
20
|
puts `clear`
|
20
21
|
if test_succeded
|
21
22
|
puts "#{GREEN_TEXT}SUCCESS!#{RESET_TEXT}\n\n\n"
|
23
|
+
Keeptesting::CLI::colorize_emacs_modeline("White", "ForestGreen")
|
22
24
|
else
|
23
25
|
puts "#{RED_TEXT}FAILURE!#{RESET_TEXT}\n\n\n"
|
26
|
+
Keeptesting::CLI::colorize_emacs_modeline("White", "Firebrick")
|
24
27
|
end
|
25
28
|
|
26
29
|
puts test_output
|
27
|
-
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.colorize_emacs_modeline(fg, bg)
|
33
|
+
#TODO only run if emacsclient exists
|
34
|
+
%x{emacsclient --eval "(set-face-attribute 'mode-line nil :background \\"#{bg}\\" :foreground \\"#{fg}\\")"}
|
35
|
+
end
|
28
36
|
|
29
37
|
def self.start_test_loop(options)
|
30
38
|
Keeptesting::CLI::testrun(options)
|
@@ -38,6 +46,6 @@ module Keeptesting
|
|
38
46
|
end
|
39
47
|
end
|
40
48
|
end
|
41
|
-
|
49
|
+
|
42
50
|
end
|
43
51
|
end
|
data/lib/keeptesting/version.rb
CHANGED
data/todo.org
CHANGED
@@ -1,24 +1,28 @@
|
|
1
|
-
*
|
2
|
-
|
3
|
-
** stop sinatra from dumping internal stuff to stdout
|
4
|
-
** make sure it looks ok in IE6,7,8
|
5
|
-
** test offline, add local copy of jquery, cut cdn dep
|
6
|
-
* swap out fssm w/ guard/listen
|
7
|
-
** fssm is dead!
|
1
|
+
* depend on onchange for monitoring/running tests?
|
2
|
+
reuse options etc, just add a few params?
|
8
3
|
* fix cli interface
|
4
|
+
** simplify usage?
|
9
5
|
** handle multiple options on same dash (-cd..)
|
6
|
+
** handle multiple paths
|
7
|
+
** only call emacsclient if present on system
|
10
8
|
** if no paths given, use */** by default
|
11
|
-
**
|
12
|
-
|
9
|
+
** make sure it doesnt die on exceptions/failures
|
10
|
+
** test more combinations of options
|
11
|
+
* what happens if new run starts before last finished?
|
13
12
|
* final code cleanup
|
14
13
|
** add tests?
|
15
|
-
|
14
|
+
* test that everything works x-platform
|
15
|
+
mac, linux
|
16
16
|
* proper documentation
|
17
17
|
** great readme
|
18
|
-
*** redgreen nice-typeface logo
|
19
|
-
|
20
18
|
*** screenshots
|
21
|
-
*** link to screencast (if not embeddable in markdown)
|
22
19
|
*** user documentation
|
23
|
-
|
20
|
+
* gpl 3
|
24
21
|
* release 1.0
|
22
|
+
** blog about it
|
23
|
+
"keeptesting: how to auto-test anything"
|
24
|
+
|
25
|
+
"I regularly use TDD for development, and when I do so I enjoy
|
26
|
+
autotesting. Don't want to use different tools for each
|
27
|
+
language/platform, scenario, since underlying process is the same:
|
28
|
+
run tests from shell, run on each file change, react to change to/from test failure"
|
metadata
CHANGED
@@ -1,90 +1,102 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: keeptesting
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 7
|
9
|
+
- 0
|
10
|
+
version: 0.7.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Thomas Kjeldahl Nilsson
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2013-05-14 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: fssm
|
16
|
-
requirement: &17940780 !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
22
|
prerelease: false
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: sinatra
|
27
|
-
requirement: &17940360 !ruby/object:Gem::Requirement
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
28
24
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
33
32
|
type: :runtime
|
34
|
-
|
35
|
-
|
36
|
-
- !ruby/object:Gem::Dependency
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
37
35
|
name: mocha
|
38
|
-
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
38
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
44
46
|
type: :development
|
45
|
-
|
46
|
-
|
47
|
-
- !ruby/object:Gem::Dependency
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
48
49
|
name: minitest
|
49
|
-
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
50
52
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
55
60
|
type: :development
|
56
|
-
|
57
|
-
|
58
|
-
- !ruby/object:Gem::Dependency
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
59
63
|
name: shoulda
|
60
|
-
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
61
66
|
none: false
|
62
|
-
requirements:
|
63
|
-
- -
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
66
74
|
type: :development
|
67
|
-
|
68
|
-
|
69
|
-
- !ruby/object:Gem::Dependency
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
70
77
|
name: shoulda-context
|
71
|
-
|
78
|
+
prerelease: false
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
72
80
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
77
88
|
type: :development
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
email:
|
89
|
+
version_requirements: *id005
|
90
|
+
description: "Usage: keeptesting [options] TESTCOMMAND"
|
91
|
+
email:
|
82
92
|
- thomas@kjeldahlnilsson.net
|
83
|
-
executables:
|
93
|
+
executables:
|
84
94
|
- keeptesting
|
85
95
|
extensions: []
|
96
|
+
|
86
97
|
extra_rdoc_files: []
|
87
|
-
|
98
|
+
|
99
|
+
files:
|
88
100
|
- .gitignore
|
89
101
|
- Gemfile
|
90
102
|
- README.md
|
@@ -99,30 +111,38 @@ files:
|
|
99
111
|
- test/test_helper.rb
|
100
112
|
- test/test_keeptesting.rb
|
101
113
|
- todo.org
|
102
|
-
- webconsole.html
|
103
|
-
- webconsole.rb
|
104
114
|
homepage: https://github.com/thomanil/keeptesting
|
105
115
|
licenses: []
|
116
|
+
|
106
117
|
post_install_message:
|
107
118
|
rdoc_options: []
|
108
|
-
|
119
|
+
|
120
|
+
require_paths:
|
109
121
|
- lib
|
110
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
123
|
none: false
|
112
|
-
requirements:
|
113
|
-
- -
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
|
116
|
-
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
hash: 3
|
128
|
+
segments:
|
129
|
+
- 0
|
130
|
+
version: "0"
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
132
|
none: false
|
118
|
-
requirements:
|
119
|
-
- -
|
120
|
-
- !ruby/object:Gem::Version
|
121
|
-
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
hash: 3
|
137
|
+
segments:
|
138
|
+
- 0
|
139
|
+
version: "0"
|
122
140
|
requirements: []
|
141
|
+
|
123
142
|
rubyforge_project: keeptesting
|
124
|
-
rubygems_version: 1.8.
|
143
|
+
rubygems_version: 1.8.25
|
125
144
|
signing_key:
|
126
145
|
specification_version: 3
|
127
|
-
summary: A
|
146
|
+
summary: A platform/language agnostic autotest tool
|
128
147
|
test_files: []
|
148
|
+
|
data/webconsole.html
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
|
6
|
-
<title>Keeptesting</title>
|
7
|
-
</head>
|
8
|
-
<body class="yellow">
|
9
|
-
|
10
|
-
<style>
|
11
|
-
.red {
|
12
|
-
background-color: #FF3B3B;
|
13
|
-
}
|
14
|
-
.green {
|
15
|
-
background-color: #3BFF3E;
|
16
|
-
}
|
17
|
-
.yellow {
|
18
|
-
background-color: #FFCB3B;
|
19
|
-
}
|
20
|
-
h1 {
|
21
|
-
-webkit-border-radius: 7px;
|
22
|
-
-moz-border-radius: 7px;
|
23
|
-
border-radius: 7px;
|
24
|
-
background-color: white;
|
25
|
-
margin: 50px 50px 50px 50px;
|
26
|
-
padding: 20px 20px 20px 20px;
|
27
|
-
background-color: white;
|
28
|
-
background-color: rgba(255,255,255,0.7);
|
29
|
-
font-family: Helvetica, Georgia;
|
30
|
-
}
|
31
|
-
#test-output {
|
32
|
-
-webkit-border-radius: 7px;
|
33
|
-
-moz-border-radius: 7px;
|
34
|
-
border-radius: 7px;
|
35
|
-
margin: 50px 50px 50px 50px;
|
36
|
-
padding: 20px 20px 20px 20px;
|
37
|
-
background-color: white;
|
38
|
-
background-color: rgba(255,255,255,0.7);
|
39
|
-
font-family: sans-serif;
|
40
|
-
}
|
41
|
-
</style>
|
42
|
-
|
43
|
-
<h1>Starting</h1>
|
44
|
-
|
45
|
-
<div id="test-output">
|
46
|
-
Waiting for first test result...
|
47
|
-
<div>
|
48
|
-
|
49
|
-
|
50
|
-
<script>
|
51
|
-
var showLastTest = function(){
|
52
|
-
$.get("/latest-test-json", function(data) {
|
53
|
-
var header = $("h1");
|
54
|
-
var last_test = data;
|
55
|
-
var test_output_div = $("#test-output");
|
56
|
-
var body = $("body")
|
57
|
-
var result = last_test.result;
|
58
|
-
|
59
|
-
header.html(result);
|
60
|
-
var test_output = last_test.output;
|
61
|
-
test_output_div.html("<pre>"+test_output+"</pre");
|
62
|
-
|
63
|
-
body.removeClass("red green yellow")
|
64
|
-
|
65
|
-
if(result.match(/Success/)){
|
66
|
-
body.addClass("green");
|
67
|
-
}
|
68
|
-
|
69
|
-
if(result.match(/Failure/)){
|
70
|
-
body.addClass("red");
|
71
|
-
}
|
72
|
-
|
73
|
-
if(result.match(/Running/)){
|
74
|
-
body.addClass("yellow");
|
75
|
-
test_output_div.html("Waiting for result...");
|
76
|
-
}
|
77
|
-
|
78
|
-
}, "json");
|
79
|
-
};
|
80
|
-
|
81
|
-
$(document).ready(function(){
|
82
|
-
setInterval(showLastTest, 300);
|
83
|
-
});
|
84
|
-
</script>
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
</body>
|
89
|
-
</html>
|
data/webconsole.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'rubygems'
|
3
|
-
require 'sinatra'
|
4
|
-
require 'keeptesting'
|
5
|
-
require 'json'
|
6
|
-
|
7
|
-
get '/' do
|
8
|
-
html_path = File.dirname(__FILE__) + '/webconsole.html'
|
9
|
-
file = File.open(html_path, "rb")
|
10
|
-
markup = file.read
|
11
|
-
end
|
12
|
-
|
13
|
-
get '/latest-test-json' do
|
14
|
-
@result, @output = Keeptesting::BrowserConsole.retrieve_last_test_summary
|
15
|
-
{:result => @result, :output => @output}.to_json
|
16
|
-
end
|