smokegraphy 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +14 -0
- data/LICENSE.txt +20 -0
- data/README.markdown +66 -0
- data/README.rdoc +19 -0
- data/Rakefile +47 -0
- data/TODO +4 -0
- data/VERSION +1 -0
- data/bin/smokegraphy +49 -0
- data/lib/smokegraphy.rb +5 -0
- data/lib/smokegraphy/resource_controller.rb +45 -0
- data/lib/smokegraphy/resource_controller/file_resource_controller.rb +59 -0
- data/lib/smokegraphy/resource_controller/ftp_resource_controller.rb +71 -0
- data/lib/smokegraphy/test_case.rb +127 -0
- data/smokegraphy.gemspec +78 -0
- data/templates/config.yaml.example +14 -0
- data/templates/flunking.html +8 -0
- data/templates/flunking.rb +10 -0
- data/templates/runner.rb +7 -0
- data/test/helper.rb +18 -0
- data/test/test_smokegraphy.rb +7 -0
- metadata +165 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "shoulda", ">= 0"
|
10
|
+
gem "yard", "~> 0.6.0"
|
11
|
+
gem "bundler", "~> 1.0.0"
|
12
|
+
gem "jeweler", "~> 1.6.0"
|
13
|
+
gem "rcov", ">= 0"
|
14
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Kenichi Otsuka
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
## Overview
|
2
|
+
|
3
|
+
Smokegraphy is a simple http access testing framework. That deploies test specific fixtures at setup, and remove them at teardown, and test must be executed with real http access. If you setup auto-deploying to use ftp, you can test not only localhost but also remote server. With Smokegraphy's test, you can find out miss configurations and/or network problems. Of course, Smokegraphy is useful to test webapps.
|
4
|
+
|
5
|
+
This is compatible with only ruby-1.8, now.
|
6
|
+
|
7
|
+
## Install
|
8
|
+
|
9
|
+
$ gem install smokegraphy
|
10
|
+
|
11
|
+
## Quick Start
|
12
|
+
|
13
|
+
Execute smokegraphy command as below. Then, directory 'simple-test' is created, and some teplates will be wrote.
|
14
|
+
|
15
|
+
$ smokegraphy new simple_test basic
|
16
|
+
$ cd simple_test
|
17
|
+
|
18
|
+
Edit config.yaml, some path, http host name, and deploy method.
|
19
|
+
|
20
|
+
Then exec runner script.
|
21
|
+
|
22
|
+
$ ./runner.rb
|
23
|
+
|
24
|
+
## Writing a Test
|
25
|
+
|
26
|
+
Below is simplest code.
|
27
|
+
|
28
|
+
class TestBasic < Smokegraphy::TestCase
|
29
|
+
def test_index_html
|
30
|
+
simple_test
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
simple_test method will access to http://server/base_path/index.html, then checks status code and response body.
|
35
|
+
|
36
|
+
|
37
|
+
* If you expected other response code, you can specify.
|
38
|
+
|
39
|
+
simple_test(:code => 403)
|
40
|
+
|
41
|
+
|
42
|
+
* If you want to check response header, use block.
|
43
|
+
|
44
|
+
simple_test { |res| assert_equals("text/html", res["Content-Type"]) }
|
45
|
+
|
46
|
+
* When you use block, default body check is disabled. So check it by your hand.
|
47
|
+
|
48
|
+
simple_test(:request_header => { "Accept-Encoding" => 'gzip,deflate' } ) do |res|
|
49
|
+
def res.read(length = nil)
|
50
|
+
self.read_body
|
51
|
+
end
|
52
|
+
assert_equal("gzip", res["Content-Encoding"])
|
53
|
+
assert_equal(File.new("source/#{@suite}/#{@filename}").read, Zlib::GzipReader.new(res).read)
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
## File Layout
|
58
|
+
|
59
|
+
Smokegraphy test should be placed as bellow
|
60
|
+
|
61
|
+
testdir / tests / test_basic.rb
|
62
|
+
| source / basic / **.html
|
63
|
+
| expected / basic / **.html.result
|
64
|
+
|
65
|
+
* Prepare fixture files (html,cgi or php) at source directory.
|
66
|
+
* Praepare result files at expected directory.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= smokegraphy
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to smokegraphy
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
+
* Fork the project
|
10
|
+
* Start a feature/bugfix branch
|
11
|
+
* Commit and push until you are happy with your contribution
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2011 Kenichi Otsuka. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "smokegraphy"
|
18
|
+
gem.homepage = "http://github.com/shivaken/smokegraphy"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{ web access testing framework }
|
21
|
+
gem.description = %Q{ Web testing framework, That deploies html htaccess and cgi before test. }
|
22
|
+
gem.email = "shivaken@gmail.com"
|
23
|
+
gem.authors = ["Kenichi Otsuka"]
|
24
|
+
gem.rubyforge_project = "smokegraphy"
|
25
|
+
# dependencies defined in Gemfile
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rake/testtask'
|
30
|
+
Rake::TestTask.new(:test) do |test|
|
31
|
+
test.libs << 'lib' << 'test'
|
32
|
+
test.pattern = 'test/**/test_*.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'rcov/rcovtask'
|
37
|
+
Rcov::RcovTask.new do |test|
|
38
|
+
test.libs << 'test'
|
39
|
+
test.pattern = 'test/**/test_*.rb'
|
40
|
+
test.verbose = true
|
41
|
+
test.rcov_opts << '--exclude "gems/*"'
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => :test
|
45
|
+
|
46
|
+
require 'yard'
|
47
|
+
YARD::Rake::YardocTask.new
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/bin/smokegraphy
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'pathname'
|
5
|
+
require 'erb'
|
6
|
+
|
7
|
+
SMOKEGRAPHY_LIBDIR = Pathname.new("#{__FILE__}/..").realpath.dirname
|
8
|
+
|
9
|
+
if ARGV[0] == "new" && ARGV[1] then
|
10
|
+
basedir = ARGV[1]
|
11
|
+
testname = ARGV[2]
|
12
|
+
|
13
|
+
def prepare_dir(dir)
|
14
|
+
FileUtils.mkdir(dir, :verbose => true) if !File.exist? dir
|
15
|
+
end
|
16
|
+
|
17
|
+
prepare_dir(basedir) if !File.exist? basedir
|
18
|
+
|
19
|
+
FileUtils.cd basedir
|
20
|
+
prepare_dir("tests")
|
21
|
+
|
22
|
+
dest = "tests/test_#{testname}.rb"
|
23
|
+
if testname && !File.exist?(dest) then
|
24
|
+
File.open(dest, "w") do |out|
|
25
|
+
out << ERB.new(File.new("#{SMOKEGRAPHY_LIBDIR}/templates/flunking.rb").read).result(binding)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
prepare_dir("source")
|
30
|
+
if testname then
|
31
|
+
prepare_dir("source/#{testname}")
|
32
|
+
dest = "source/#{testname}/index.html"
|
33
|
+
if !File.exist?(dest) then
|
34
|
+
File.open(dest, "w") do |out|
|
35
|
+
out << ERB.new(File.new("#{SMOKEGRAPHY_LIBDIR}/templates/flunking.html").read).result(binding)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
prepare_dir("expected")
|
41
|
+
prepare_dir("expected/#{testname}") if testname
|
42
|
+
|
43
|
+
FileUtils.copy "#{SMOKEGRAPHY_LIBDIR}/templates/config.yaml.example", "config.yaml"
|
44
|
+
FileUtils.copy "#{SMOKEGRAPHY_LIBDIR}/templates/runner.rb", "runner.rb"
|
45
|
+
|
46
|
+
else
|
47
|
+
print "Error: invalid argument\n"
|
48
|
+
exit 1
|
49
|
+
end
|
data/lib/smokegraphy.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
module Smokegraphy
|
2
|
+
|
3
|
+
class ResourceController
|
4
|
+
|
5
|
+
def ResourceController.build(config)
|
6
|
+
case (config["deploy"])
|
7
|
+
when "ftp"
|
8
|
+
FtpResourceController.new(config)
|
9
|
+
when "file"
|
10
|
+
FileResourceController.new(config)
|
11
|
+
else
|
12
|
+
ResourceController.new(config)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(config)
|
17
|
+
@config = config
|
18
|
+
end
|
19
|
+
|
20
|
+
# initialize
|
21
|
+
#
|
22
|
+
# must be called once before running tests
|
23
|
+
def init
|
24
|
+
end
|
25
|
+
|
26
|
+
# close
|
27
|
+
#
|
28
|
+
# must be called once after all tests.
|
29
|
+
def close
|
30
|
+
end
|
31
|
+
|
32
|
+
def transfer_source_file(filename, testsuite, destname = nil)
|
33
|
+
end
|
34
|
+
|
35
|
+
def add_execute_permission(filename)
|
36
|
+
end
|
37
|
+
|
38
|
+
def cleanup(filename = nil)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
require 'smokegraphy/resource_controller/ftp_resource_controller'
|
43
|
+
require 'smokegraphy/resource_controller/file_resource_controller'
|
44
|
+
end
|
45
|
+
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'erb'
|
3
|
+
|
4
|
+
module Smokegraphy
|
5
|
+
|
6
|
+
class FileResourceController < ResourceController
|
7
|
+
|
8
|
+
def initialize(config)
|
9
|
+
@config = config
|
10
|
+
end
|
11
|
+
|
12
|
+
def init
|
13
|
+
@uploaded = []
|
14
|
+
end
|
15
|
+
|
16
|
+
def transfer_source_file(filename, testsuite, destname = nil)
|
17
|
+
|
18
|
+
begin
|
19
|
+
source = "source/#{testsuite}/#{filename}"
|
20
|
+
destname ||= filename
|
21
|
+
destfile_path = "#{@config["file"]["path"]}/#{destname}"
|
22
|
+
|
23
|
+
if File.exist?(source) then
|
24
|
+
document_root = @config["http"]["document_root"]
|
25
|
+
erb = ERB.new(File.new(source).read)
|
26
|
+
|
27
|
+
File.open(destfile_path, "w") { |out| out << erb.result(binding) }
|
28
|
+
@uploaded << destfile_path if !(@uploaded.include? destfile_path)
|
29
|
+
|
30
|
+
else
|
31
|
+
raise "no such file: #{source}"
|
32
|
+
end
|
33
|
+
|
34
|
+
rescue => evar
|
35
|
+
raise "Failed to copy #{source}: #{evar}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def add_execute_permission(filename)
|
40
|
+
begin
|
41
|
+
File.chmod 0755, "#{@config["file"]["path"]}/#{filename}"
|
42
|
+
rescue => evar
|
43
|
+
print "Failed to chmod #{filename}: #{evar}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def cleanup(filename = nil)
|
48
|
+
if filename then
|
49
|
+
filepath = "#{@config["file"]["path"]}/#{filename}"
|
50
|
+
FileUtils.rm(filepath, :force => true)
|
51
|
+
@uploaded.delete filepath
|
52
|
+
else
|
53
|
+
@uploaded.each do |f|
|
54
|
+
FileUtils.rm(f, :force => true)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'net/ftptls'
|
2
|
+
require 'erb'
|
3
|
+
require 'tempfile'
|
4
|
+
|
5
|
+
module Smokegraphy
|
6
|
+
|
7
|
+
class FtpResourceController < ResourceController
|
8
|
+
|
9
|
+
def initialize(config)
|
10
|
+
@config = config
|
11
|
+
end
|
12
|
+
|
13
|
+
def init
|
14
|
+
@uploaded = []
|
15
|
+
if (@config["deploy"] == "ftp" && $ftp == nil) then
|
16
|
+
@@ftp = Net::FTPTLS.new(@config["ftp"]["server"],
|
17
|
+
@config["ftp"]["username"],
|
18
|
+
@config["ftp"]["password"]);
|
19
|
+
@@ftp.passive = true
|
20
|
+
@@ftp.debug_mode = false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def close
|
25
|
+
@@ftp.close
|
26
|
+
end
|
27
|
+
|
28
|
+
def transfer_source_file(filename, testsuite, destname = nil)
|
29
|
+
begin
|
30
|
+
source = "source/#{testsuite}/#{filename}"
|
31
|
+
destname ||= filename
|
32
|
+
|
33
|
+
if File.exist?(source) then
|
34
|
+
document_root = @config["http"]["document_root"]
|
35
|
+
|
36
|
+
temp = Tempfile.new("ftp_")
|
37
|
+
File.open(temp.path, "w") { |out| out << ERB.new(File.new(source).read).result(binding) }
|
38
|
+
@@ftp.put(temp.path, destname)
|
39
|
+
temp.close
|
40
|
+
|
41
|
+
@uploaded << destname if !(@uploaded.include? destname)
|
42
|
+
else
|
43
|
+
raise "no such file: #{source}"
|
44
|
+
end
|
45
|
+
rescue => evar
|
46
|
+
raise "Failed to copy #{filename}: #{evar}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def add_execute_permission(filename)
|
51
|
+
begin
|
52
|
+
@@ftp.voidcmd("site chmod 755 #{filename}")
|
53
|
+
rescue => evar
|
54
|
+
print "Failed to chmod #{filename}: #{evar}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def cleanup(filename = nil)
|
59
|
+
if filename then
|
60
|
+
files = @@ftp.nlst
|
61
|
+
@@ftp.delete(filename) if files.include?(filename)
|
62
|
+
@uploaded.delete filename
|
63
|
+
else
|
64
|
+
files = @@ftp.nlst
|
65
|
+
@uploaded.each do |f|
|
66
|
+
@@ftp.delete(f) if files.include?(f)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'net/http'
|
3
|
+
require 'test/unit'
|
4
|
+
require 'logger'
|
5
|
+
require 'smokegraphy/resource_controller'
|
6
|
+
|
7
|
+
module Smokegraphy
|
8
|
+
|
9
|
+
class TestCase < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def self.suite
|
12
|
+
suite = super
|
13
|
+
|
14
|
+
@@config = YAML.load_file('config.yaml')
|
15
|
+
@@rc = ResourceController.build(@@config)
|
16
|
+
@@http_server = @@config["http"]["server"]
|
17
|
+
|
18
|
+
def suite.run(*args)
|
19
|
+
if (name != "Smokegraphy::TestCase") then
|
20
|
+
@@rc.init
|
21
|
+
super
|
22
|
+
@@rc.close
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
suite
|
27
|
+
end
|
28
|
+
|
29
|
+
def setup
|
30
|
+
@log = Logger.new("test.log")
|
31
|
+
@log.datetime_format = "%Y-%m-%d %H:%M:%S"
|
32
|
+
|
33
|
+
name.match(/(.*)\((.*)\)/)
|
34
|
+
@testname = $1
|
35
|
+
@suite = $2.gsub(/([A-Z])/, "_\\1").downcase.gsub(/^_/,"").gsub(/^test_/,"")
|
36
|
+
@filename = @testname.gsub(/test_(.*)_([^_]*)$/, "\\1.\\2").gsub(/_html/,".html")
|
37
|
+
prepare
|
38
|
+
end
|
39
|
+
|
40
|
+
def teardown
|
41
|
+
# @@rc.cleanup
|
42
|
+
end
|
43
|
+
|
44
|
+
def prepare
|
45
|
+
@@rc.transfer_source_file(@filename, @suite)
|
46
|
+
suffix = @filename.gsub(/[^\.]*\.([a-z0-9]*)/, "\\1")
|
47
|
+
@@rc.add_execute_permission(@filename) if suffix == "cgi"
|
48
|
+
|
49
|
+
# no warning
|
50
|
+
begin
|
51
|
+
@@rc.transfer_source_file("#{@filename.gsub(/\./, "_")}.htaccess", @suite, ".htaccess")
|
52
|
+
rescue => ever
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def deploy(filename)
|
57
|
+
@@rc.transfer_source_file(filename, @suite)
|
58
|
+
end
|
59
|
+
|
60
|
+
def simple_test(options = {})
|
61
|
+
|
62
|
+
@@rc.transfer_source_file("#{options[:htaccess]}.htaccess", @suite, ".htaccess") if (options[:htaccess])
|
63
|
+
|
64
|
+
begin
|
65
|
+
|
66
|
+
# prepare request object
|
67
|
+
uri = "/"
|
68
|
+
if @@config["http"]["base_path"] then
|
69
|
+
uri << @@config["http"]["base_path"]
|
70
|
+
uri << "/"
|
71
|
+
end
|
72
|
+
|
73
|
+
uri << (options[:request_uri] ? options[:request_uri] : @filename)
|
74
|
+
|
75
|
+
uri << "?%s" % options[:query].map { |k,v| "%s=%s" % [k,v] }.sort.join("&") if options[:query]
|
76
|
+
|
77
|
+
if (options[:method] == :post) then
|
78
|
+
req = Net::HTTP::Post.new(uri)
|
79
|
+
req.body = options[:post_data].map { |k,v| "%s=%s" % [k,v] }.sort.join("&") if options[:post_data]
|
80
|
+
req["Request-Method"] = "POST"
|
81
|
+
req["Content-Length"] = req.body.size
|
82
|
+
else
|
83
|
+
req = Net::HTTP::Get.new(uri)
|
84
|
+
end
|
85
|
+
|
86
|
+
# setup request header
|
87
|
+
options[:request_header].each {|k,v| req[k] = v } if (options[:request_header] != nil)
|
88
|
+
req["Host"] = @@http_server
|
89
|
+
Net::HTTP.start(@@http_server, 80) do |http|
|
90
|
+
|
91
|
+
# execute http access
|
92
|
+
res = http.request(req)
|
93
|
+
|
94
|
+
# check status code.
|
95
|
+
assert_equal(options[:code] ? options[:code].to_s : "200", res.code,
|
96
|
+
"status code check failed. [filename: #{@filename}]")
|
97
|
+
|
98
|
+
# check body
|
99
|
+
if (res.code == "200" && (!block_given? || options[:expected] == true)) then
|
100
|
+
expected = "expected/#{@suite}/#{@filename.gsub(/\./, "_")}.result"
|
101
|
+
assert_equal(File.new(File.exist?(expected) ? expected : "source/#{@suite}/#{@filename}").read, res.body)
|
102
|
+
end
|
103
|
+
|
104
|
+
# block process
|
105
|
+
yield res if block_given?
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
rescue => evar
|
110
|
+
@log.info(evar)
|
111
|
+
result = "Failed"
|
112
|
+
|
113
|
+
else
|
114
|
+
result = "Success"
|
115
|
+
|
116
|
+
ensure
|
117
|
+
@log.info("test #{@suite}:#{@filename}: #{result} [#{options.keys.join(", ")}]")
|
118
|
+
|
119
|
+
@@rc.cleanup(".htaccess") if options[:htaccess]
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
raise evar if (evar)
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
end
|
data/smokegraphy.gemspec
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{smokegraphy}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Kenichi Otsuka"]
|
12
|
+
s.date = %q{2011-05-30}
|
13
|
+
s.default_executable = %q{smokegraphy}
|
14
|
+
s.description = %q{ Web testing framework, That deploies html htaccess and cgi before test. }
|
15
|
+
s.email = %q{shivaken@gmail.com}
|
16
|
+
s.executables = ["smokegraphy"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.markdown",
|
20
|
+
"README.rdoc",
|
21
|
+
"TODO"
|
22
|
+
]
|
23
|
+
s.files = [
|
24
|
+
".document",
|
25
|
+
"Gemfile",
|
26
|
+
"LICENSE.txt",
|
27
|
+
"README.markdown",
|
28
|
+
"README.rdoc",
|
29
|
+
"Rakefile",
|
30
|
+
"TODO",
|
31
|
+
"VERSION",
|
32
|
+
"bin/smokegraphy",
|
33
|
+
"lib/smokegraphy.rb",
|
34
|
+
"lib/smokegraphy/resource_controller.rb",
|
35
|
+
"lib/smokegraphy/resource_controller/file_resource_controller.rb",
|
36
|
+
"lib/smokegraphy/resource_controller/ftp_resource_controller.rb",
|
37
|
+
"lib/smokegraphy/test_case.rb",
|
38
|
+
"smokegraphy.gemspec",
|
39
|
+
"templates/config.yaml.example",
|
40
|
+
"templates/flunking.html",
|
41
|
+
"templates/flunking.rb",
|
42
|
+
"templates/runner.rb",
|
43
|
+
"test/helper.rb",
|
44
|
+
"test/test_smokegraphy.rb"
|
45
|
+
]
|
46
|
+
s.homepage = %q{http://github.com/shivaken/smokegraphy}
|
47
|
+
s.licenses = ["MIT"]
|
48
|
+
s.require_paths = ["lib"]
|
49
|
+
s.rubyforge_project = %q{smokegraphy}
|
50
|
+
s.rubygems_version = %q{1.3.7}
|
51
|
+
s.summary = %q{web access testing framework}
|
52
|
+
|
53
|
+
if s.respond_to? :specification_version then
|
54
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
55
|
+
s.specification_version = 3
|
56
|
+
|
57
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
58
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
60
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
61
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
|
62
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
63
|
+
else
|
64
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
65
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
66
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
67
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
68
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
69
|
+
end
|
70
|
+
else
|
71
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
72
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
73
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
74
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
75
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
data/templates/runner.rb
ADDED
data/test/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'smokegraphy'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: smokegraphy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Kenichi Otsuka
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-05-30 00:00:00 +09:00
|
19
|
+
default_executable: smokegraphy
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
prerelease: false
|
23
|
+
name: shoulda
|
24
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
requirement: *id001
|
34
|
+
type: :development
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
prerelease: false
|
37
|
+
name: yard
|
38
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 7
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
- 6
|
47
|
+
- 0
|
48
|
+
version: 0.6.0
|
49
|
+
requirement: *id002
|
50
|
+
type: :development
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
prerelease: false
|
53
|
+
name: bundler
|
54
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 23
|
60
|
+
segments:
|
61
|
+
- 1
|
62
|
+
- 0
|
63
|
+
- 0
|
64
|
+
version: 1.0.0
|
65
|
+
requirement: *id003
|
66
|
+
type: :development
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
prerelease: false
|
69
|
+
name: jeweler
|
70
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 15
|
76
|
+
segments:
|
77
|
+
- 1
|
78
|
+
- 6
|
79
|
+
- 0
|
80
|
+
version: 1.6.0
|
81
|
+
requirement: *id004
|
82
|
+
type: :development
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
prerelease: false
|
85
|
+
name: rcov
|
86
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
92
|
+
segments:
|
93
|
+
- 0
|
94
|
+
version: "0"
|
95
|
+
requirement: *id005
|
96
|
+
type: :development
|
97
|
+
description: " Web testing framework, That deploies html htaccess and cgi before test. "
|
98
|
+
email: shivaken@gmail.com
|
99
|
+
executables:
|
100
|
+
- smokegraphy
|
101
|
+
extensions: []
|
102
|
+
|
103
|
+
extra_rdoc_files:
|
104
|
+
- LICENSE.txt
|
105
|
+
- README.markdown
|
106
|
+
- README.rdoc
|
107
|
+
- TODO
|
108
|
+
files:
|
109
|
+
- .document
|
110
|
+
- Gemfile
|
111
|
+
- LICENSE.txt
|
112
|
+
- README.markdown
|
113
|
+
- README.rdoc
|
114
|
+
- Rakefile
|
115
|
+
- TODO
|
116
|
+
- VERSION
|
117
|
+
- bin/smokegraphy
|
118
|
+
- lib/smokegraphy.rb
|
119
|
+
- lib/smokegraphy/resource_controller.rb
|
120
|
+
- lib/smokegraphy/resource_controller/file_resource_controller.rb
|
121
|
+
- lib/smokegraphy/resource_controller/ftp_resource_controller.rb
|
122
|
+
- lib/smokegraphy/test_case.rb
|
123
|
+
- smokegraphy.gemspec
|
124
|
+
- templates/config.yaml.example
|
125
|
+
- templates/flunking.html
|
126
|
+
- templates/flunking.rb
|
127
|
+
- templates/runner.rb
|
128
|
+
- test/helper.rb
|
129
|
+
- test/test_smokegraphy.rb
|
130
|
+
has_rdoc: true
|
131
|
+
homepage: http://github.com/shivaken/smokegraphy
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
post_install_message:
|
135
|
+
rdoc_options: []
|
136
|
+
|
137
|
+
require_paths:
|
138
|
+
- lib
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
hash: 3
|
145
|
+
segments:
|
146
|
+
- 0
|
147
|
+
version: "0"
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
hash: 3
|
154
|
+
segments:
|
155
|
+
- 0
|
156
|
+
version: "0"
|
157
|
+
requirements: []
|
158
|
+
|
159
|
+
rubyforge_project: smokegraphy
|
160
|
+
rubygems_version: 1.3.7
|
161
|
+
signing_key:
|
162
|
+
specification_version: 3
|
163
|
+
summary: web access testing framework
|
164
|
+
test_files: []
|
165
|
+
|