Skip to content

Commit

Permalink
first commint
Browse files Browse the repository at this point in the history
  • Loading branch information
vigoss authored and vigoss committed May 9, 2015
0 parents commit 58fb783
Show file tree
Hide file tree
Showing 46 changed files with 14,080 additions and 0 deletions.
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--color
21 changes: 21 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
source 'http://rubygems.org'
# Add dependencies required to use your gem here.
# Example:
# gem "activesupport", ">= 2.3.5"

gem 'erubis', '>= 2.7.0'
gem 'json', '>= 1.7.0'

# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
gem 'rspec', '~> 2.8.0'
gem 'rdoc', '~> 3.12'
gem 'bundler', '> 1.0.0'
gem 'jeweler', '~> 1.8.4'
if RUBY_VERSION > '1.9' then
gem 'simplecov', '>= 0.8.2'
else
gem 'rcov', '>= 0'
end
end
57 changes: 57 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# encoding: utf-8

require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'

require 'jeweler'
Jeweler::Tasks.new do |gem|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
gem.name = 'crash_monkey'
gem.homepage = 'https://github.com/mokemokechicken/CrashMonkey'
gem.license = 'MIT'
gem.summary = 'Monkey Test For iOS Application'
gem.description = 'This is a Monkey Test Tool using UIAutomation.'
gem.email = '[email protected]'
gem.authors = ['Ken Morishita']
# dependencies defined in Gemfile
end
Jeweler::RubygemsDotOrgTasks.new

require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
end

if RUBY_VERSION > '1.9'
desc "Code coverage detail"
task :simplecov do
ENV['COVERAGE'] = "true"
Rake::Task['spec'].execute
end
else
RSpec::Core::RakeTask.new(:rcov) do |spec|
spec.pattern = 'spec/**/*_spec.rb'
spec.rcov = true
end
end

task :default => :spec

require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ''

rdoc.rdoc_dir = 'rdoc'
rdoc.title = "CrashMonkey #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
46 changes: 46 additions & 0 deletions bin/crash_monkey
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env ruby

Version = File.read(File.expand_path('../../VERSION', __FILE__))

require 'optparse'

$: << File.dirname(__FILE__) + '/../lib'
require 'crash_monkey'

opts = {}
ARGV.options do |o|
o.on('-a app_name', 'Target Application(Required)') {|b| opts[:app_path] = b}
o.on('-w device', 'Target Device(Required)') {|b| opts[:device] = b}
o.on('-n run_count', 'How many times monkeys run(default: 2)') {|b| opts[:run_count] = b.to_i}
o.on('-d result_dir', 'Where to output result(default: ./crash_monkey_result)') {|b| opts[:result_base_dir] = File.expand_path(b)}
o.on('-t time_limit_sec', 'Time limit of running(default: 100 sec)') {|b| opts[:time_limit_sec] = b.to_i}
o.on('-c config_path', 'Configuration JSON Path') {|b| opts[:config_path] = File.expand_path(b)}
o.on('-e extend_javascript_path', 'Extend Uiautomation Javascript for such Login scripts') {|b| opts[:extend_javascript_path] = File.expand_path(b)}
o.on('--show-config', 'Show Current Configuration JSON') {|_| opts[:show_config] = true}
o.on('--list-app', 'Show List of Installed Apps in iOS Simulator') {|_| opts[:list_app] = true}
o.on('--list-devices', 'Show List of Devices') {|_| opts[:list_devices] = true}
o.on('--reset-iPhone-Simulator', 'Reset iPhone Simulator'){|_| opts[:reset_iphone_simulator] = true}
o.on('--version', 'print crash monkey version'){|_| opts[:version] = true}
o.parse!
end

if opts[:version]
dirname = File.dirname(File.dirname(__FILE__))
filepath = File.join(dirname, "VERSION")
puts File.open(filepath, 'rb') { |file| file.read }
exit(1)
end

unless opts[:app_path] || opts[:show_config] || opts[:list_app] || opts[:reset_iphone_simulator] || opts[:list_devices]
puts ARGV.options.help
exit(1)
end

opts[:run_count] ||= 2
opts[:time_limit_sec] ||= 100

result_ok = UIAutoMonkey::MonkeyRunner.new.run(opts)

puts result_ok ? 'EXIT 0' : 'EXIT 1' unless opts[:show_config] || opts[:list_app] || opts[:list_devices]

exit(result_ok ? 0 : 1)
96 changes: 96 additions & 0 deletions crash_monkey.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{crash_monkey}
version_path = File.join(File.dirname(__FILE__), "VERSION")
s.version = File.read(version_path)

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Ken Morishita"]
s.date = %q{2014-03-28}
s.default_executable = %q{crash_monkey}
s.description = %q{This is a Monkey Test Tool using UIAutomation.}
s.email = %q{[email protected]}
s.executables = ["crash_monkey"]
s.extra_rdoc_files = [
"LICENSE.txt",
"README.md",
"README.rdoc"
]
s.files = [
".document",
".rspec",
"Gemfile",
"Gemfile.lock",
"LICENSE.txt",
"README.md",
"README.rdoc",
"Rakefile",
"VERSION",
"bin/crash_monkey",
"crash_monkey.gemspec",
"lib/bootstrap/css/bootstrap-responsive.css",
"lib/bootstrap/css/bootstrap-responsive.min.css",
"lib/bootstrap/css/bootstrap.css",
"lib/bootstrap/css/bootstrap.min.css",
"lib/bootstrap/img/glyphicons-halflings-white.png",
"lib/bootstrap/img/glyphicons-halflings.png",
"lib/bootstrap/js/bootstrap.js",
"lib/bootstrap/js/bootstrap.min.js",
"lib/crash_monkey.rb",
"lib/crash_monkey/command_helper.rb",
"lib/crash_monkey/monkey_runner.rb",
"lib/crash_monkey/templates/config.json",
"lib/crash_monkey/templates/index.html.erb",
"lib/crash_monkey/templates/result.html.erb",
"lib/crash_monkey/templates/result_view.coffee",
"lib/crash_monkey/templates/result_view.js",
"lib/ui-auto-monkey/LICENSE",
"lib/ui-auto-monkey/README.md",
"lib/ui-auto-monkey/UIAutoMonkey.js",
"spec/spec_helper.rb"
]
s.homepage = %q{https://github.com/mokemokechicken/CrashMonkey}
s.licenses = ["MIT"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.6.2}
s.summary = %q{Monkey Test For iOS Application}

if s.respond_to? :specification_version then
s.specification_version = 3

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<erubis>, [">= 2.7.0"])
s.add_runtime_dependency(%q<json>, [">= 1.7.0"])
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
s.add_development_dependency(%q<bundler>, ["> 1.0.0"])
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
s.add_development_dependency(%q<rcov>, [">= 0"])
else
s.add_dependency(%q<erubis>, [">= 2.7.0"])
s.add_dependency(%q<json>, [">= 1.7.0"])
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
s.add_dependency(%q<rdoc>, ["~> 3.12"])
s.add_dependency(%q<bundler>, ["> 1.0.0"])
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
if RUBY_VERSION > '1.9' then
s.add_dependency(%q<simplecov>, [">= 0"])
else
s.add_dependency(%q<rcov>, [">= 0"])
end
end
else
s.add_dependency(%q<erubis>, [">= 2.7.0"])
s.add_dependency(%q<json>, [">= 1.7.0"])
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
s.add_dependency(%q<rdoc>, ["~> 3.12"])
s.add_dependency(%q<bundler>, ["> 1.0.0"])
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
s.add_dependency(%q<rcov>, [">= 0"])
end
end

22 changes: 22 additions & 0 deletions example_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"numberOfEvents": 100,
"delayBetweenEvents": 0.05,

"eventWeights": {
"tap": 500,
"drag": 1,
"flick": 1,
"orientation": 1,
"clickVolumeUp": 1,
"clickVolumeDown": 1,
"pinchClose": 10,
"pinchOpen": 10,
"shake": 1
},

"touchProbability": {
"multipleTaps": 0.05,
"multipleTouches": 0.05,
"longPress": 0.05
}
}
Loading

0 comments on commit 58fb783

Please sign in to comment.