auto_test 0.0.1
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.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +61 -0
- data/auto_test.gemspec +24 -0
- data/lib/auto_test.rb +104 -0
- data/lib/auto_test/version.rb +3 -0
- metadata +116 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Maike Hargens
|
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
@@ -0,0 +1,29 @@
|
|
1
|
+
# AutoTest
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'auto_test'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install auto_test
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
Bundler::GemHelper.install_tasks
|
4
|
+
|
5
|
+
namespace :auto_test do
|
6
|
+
desc "starting the test"
|
7
|
+
task :test do
|
8
|
+
puts "Running auto_test..."
|
9
|
+
sh "rails server -e test -p 3002 -d"
|
10
|
+
sh "rspec lib/spec/requests/auto_spec.rb -o 'log/rspec.txt'"
|
11
|
+
sh "rm 'log/rspec.txt'"
|
12
|
+
Rake::Task[:error_calc].invoke
|
13
|
+
Rake::Task[:stop].invoke
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "calculating the errors"
|
17
|
+
task :error_calc do
|
18
|
+
err = File.read("log/errors.log")
|
19
|
+
if err.to_i > 0 then
|
20
|
+
puts "Do you want to see the error-path in firefox? Type yes/no:"
|
21
|
+
a = STDIN.gets.chomp
|
22
|
+
if a == "yes" then
|
23
|
+
Rake::Task[:reduce_errors].invoke
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "Reducing the error path"
|
29
|
+
task :reduce_errors do
|
30
|
+
puts "Reducing the error path, this could take a while..."
|
31
|
+
sh "rspec lib/spec/requests/error_reduction_spec.rb -o 'log/reduce_err.txt'"
|
32
|
+
sh "rm 'log/reduce_err.txt'"
|
33
|
+
Rake::Task[:start_action_path].invoke
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "starting the simulation"
|
37
|
+
task :start_action_path do
|
38
|
+
# paths = File.new("lib/auto_test/log/new_path.log")
|
39
|
+
# n = 0
|
40
|
+
# while line = paths.gets do
|
41
|
+
# n = n + 1
|
42
|
+
# end
|
43
|
+
# puts "Error path reduced.There are #{n} paths to be visited."
|
44
|
+
# puts "Press Enter to see the path in Firefox! "
|
45
|
+
# STDIN.gets
|
46
|
+
ruby 'lib/simulation.rb'
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
desc 'stopping rails'
|
51
|
+
task :stop do
|
52
|
+
begin
|
53
|
+
pid_file = 'tmp/pids/server.pid'
|
54
|
+
pid = File.read(pid_file).to_i
|
55
|
+
Process.kill 9, pid
|
56
|
+
File.delete pid_file
|
57
|
+
rescue
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
data/auto_test.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/auto_test/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Maike Hargens"]
|
6
|
+
gem.email = ["mkh@informatik.uni-kiel.de"]
|
7
|
+
gem.description = %q{Automatic Testing Tool}
|
8
|
+
gem.summary = %q{Tests applications automatically and randomly}
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
gem.add_development_dependency('faker')
|
13
|
+
gem.add_development_dependency('rspec')
|
14
|
+
gem.add_development_dependency('capybara')
|
15
|
+
gem.add_development_dependency('database_cleaner')
|
16
|
+
gem.add_development_dependency('watir-webdriver')
|
17
|
+
|
18
|
+
gem.files = `git ls-files`.split($\)
|
19
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
20
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
21
|
+
gem.name = "auto_test"
|
22
|
+
gem.require_paths = ["lib"]
|
23
|
+
gem.version = AutoTest::VERSION
|
24
|
+
end
|
data/lib/auto_test.rb
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
require "auto_test/version"
|
2
|
+
|
3
|
+
def logger
|
4
|
+
Rails.logger
|
5
|
+
end
|
6
|
+
|
7
|
+
module AutoTest
|
8
|
+
class << self
|
9
|
+
attr_accessor :configuration
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.configure
|
13
|
+
self.configuration ||= Configuration.new
|
14
|
+
yield(configuration)
|
15
|
+
end
|
16
|
+
|
17
|
+
class Configuration
|
18
|
+
def initialize
|
19
|
+
Test.initialize_test
|
20
|
+
Rails.logger.level = 1
|
21
|
+
DatabaseCleaner.strategy = :truncation
|
22
|
+
DatabaseCleaner.start
|
23
|
+
DatabaseCleaner.clean
|
24
|
+
end
|
25
|
+
|
26
|
+
def links_to_exclude(*links)
|
27
|
+
Dsl.links_to_exclude(*links)
|
28
|
+
end
|
29
|
+
|
30
|
+
def set_max_depth(value)
|
31
|
+
Dsl.set_max_depth(value)
|
32
|
+
end
|
33
|
+
|
34
|
+
def set_number_of_sessions(number)
|
35
|
+
Dsl.set_number_of_sessions(number)
|
36
|
+
end
|
37
|
+
|
38
|
+
# add an array of the classname, key and value of the object to be checked every cycle
|
39
|
+
def always_present(class_name, key, value)
|
40
|
+
Dsl.always_present(class_name, key, value)
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_users_from_db(user_class_name, bool)
|
44
|
+
Dsl.get_users_from_db(user_class_name, bool)
|
45
|
+
end
|
46
|
+
|
47
|
+
def set_unique_login_attribute_name(name)
|
48
|
+
Dsl.set_unique_login_attribute_name(name)
|
49
|
+
end
|
50
|
+
|
51
|
+
def set_login_data(*data)
|
52
|
+
Dsl.set_login_data(*data)
|
53
|
+
end
|
54
|
+
|
55
|
+
# for the name or part of the name of an input field, decide, which values to use
|
56
|
+
# if not set, random values matching the input type are used
|
57
|
+
def set_input(input, *values)
|
58
|
+
Dsl.set_input(input, *values)
|
59
|
+
end
|
60
|
+
|
61
|
+
# for all objects of class child, there has to be one object of class parent
|
62
|
+
# attribute_name is the column that joins the two tables
|
63
|
+
def set_object_dependency(child, parent, attribute_name)
|
64
|
+
Dsl.set_object_dependency(child, parent, attribute_name)
|
65
|
+
end
|
66
|
+
|
67
|
+
# set the login path
|
68
|
+
def set_login_path(path)
|
69
|
+
Dsl.set_login_path(path)
|
70
|
+
end
|
71
|
+
|
72
|
+
# set the attribute_names and fields that are needed to login
|
73
|
+
# the argument is a list of pairs [attribute_name, field]
|
74
|
+
def set_login_attribute_names(logins, fields)
|
75
|
+
Dsl.set_login_attribute_names(logins, fields)
|
76
|
+
end
|
77
|
+
|
78
|
+
def set_max_number_of_session_links(no)
|
79
|
+
Dsl.set_max_number_of_session_links(no)
|
80
|
+
end
|
81
|
+
|
82
|
+
def set_no_auth
|
83
|
+
Dsl.set_no_auth
|
84
|
+
end
|
85
|
+
|
86
|
+
def set_logout_path(path)
|
87
|
+
Dsl.set_logout_path(path)
|
88
|
+
end
|
89
|
+
|
90
|
+
def stop_at_first_error(stop_at_first_error)
|
91
|
+
Dsl.stop_at_first_error(stop_at_first_error)
|
92
|
+
end
|
93
|
+
|
94
|
+
def set_number_of_test_runs(number)
|
95
|
+
Dsl.set_number_of_test_runs(number)
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
autoload :Dsl, 'auto_test/lib/auto_test/dsl'
|
101
|
+
autoload :Test, 'auto_test/lib/auto_test/test'
|
102
|
+
|
103
|
+
|
104
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: auto_test
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Maike Hargens
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2012-10-02 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: faker
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :development
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rspec
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: capybara
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: database_cleaner
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
type: :development
|
58
|
+
version_requirements: *id004
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: watir-webdriver
|
61
|
+
prerelease: false
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
type: :development
|
69
|
+
version_requirements: *id005
|
70
|
+
description: Automatic Testing Tool
|
71
|
+
email:
|
72
|
+
- mkh@informatik.uni-kiel.de
|
73
|
+
executables: []
|
74
|
+
|
75
|
+
extensions: []
|
76
|
+
|
77
|
+
extra_rdoc_files: []
|
78
|
+
|
79
|
+
files:
|
80
|
+
- .gitignore
|
81
|
+
- Gemfile
|
82
|
+
- LICENSE
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- auto_test.gemspec
|
86
|
+
- lib/auto_test.rb
|
87
|
+
- lib/auto_test/version.rb
|
88
|
+
homepage:
|
89
|
+
licenses: []
|
90
|
+
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: "0"
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: "0"
|
108
|
+
requirements: []
|
109
|
+
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 1.8.24
|
112
|
+
signing_key:
|
113
|
+
specification_version: 3
|
114
|
+
summary: Tests applications automatically and randomly
|
115
|
+
test_files: []
|
116
|
+
|