mirror of
https://github.com/copyrighttxt/watrbx-game-engine.git
synced 2026-09-05 21:27:48 +00:00
89 lines
2.3 KiB
Ruby
89 lines
2.3 KiB
Ruby
require 'rubygems'
|
|
require 'cucumber'
|
|
require 'cucumber/rake/task'
|
|
require 'parallel'
|
|
require 'json'
|
|
require 'yard'
|
|
require 'fileutils'
|
|
|
|
task :cleanup do
|
|
puts ' ========Deleting old reports and logs========='
|
|
FileUtils.rm_rf('reports')
|
|
File.delete('cucumber_failures.log') if File.exist?('cucumber_failures.log')
|
|
File.new('cucumber_failures.log', 'w')
|
|
Dir.mkdir('reports')
|
|
end
|
|
|
|
task :parallel_run do
|
|
puts '===== Executing Tests in parallel'
|
|
system 'bundle exec parallel_cucumber features/ -o "-p android" -n 1'
|
|
puts ' ====== Parallel execution finished and cucumber_failure.log created ========='
|
|
end
|
|
|
|
task :rerun do
|
|
if File.size('cucumber_failures.log') == 0
|
|
puts '==== No failures. Everything Passed ========='
|
|
else
|
|
puts ' =========Re-running Failed Scenarios============='
|
|
system 'bundle exec cucumber @cucumber_failures.log -f pretty'
|
|
end
|
|
end
|
|
|
|
task parallel_cucumber: [:cleanup, :parallel_run, :rerun]
|
|
|
|
YARD::Rake::YardocTask.new(:yard) do |t|
|
|
t.files = ['features/**/*.feature', 'features/**/*.rb, lib/**/*.rb']
|
|
end
|
|
|
|
Cucumber::Rake::Task.new(:sauce) do |t|
|
|
t.cucumber_opts = 'features -p sauce --format pretty --profile html'
|
|
end
|
|
|
|
Cucumber::Rake::Task.new(:ios) do |t|
|
|
t.cucumber_opts = 'features OS=ios features -t @ios'
|
|
end
|
|
|
|
Cucumber::Rake::Task.new(:android) do |t|
|
|
t.cucumber_opts = 'features OS=android features -t @android'
|
|
end
|
|
|
|
task :cuke_sniffer do
|
|
system('bundle exec cuke_sniffer --out html reports/cuke_sniffer.html')
|
|
end
|
|
|
|
task :rubocop do
|
|
system('bundle exec rubocop')
|
|
end
|
|
|
|
def run_android_tests
|
|
system('bundle exec cucumber OS=android features -t @android')
|
|
end
|
|
|
|
def run_android_tests_tc
|
|
system('bundle exec cucumber OS=android features -t @android -f TeamCityFormatter::Formatter -f html -o reports/report.html')
|
|
end
|
|
|
|
def run_ios_tests
|
|
system('bundle exec cucumber OS=ios features -t @ios')
|
|
end
|
|
|
|
def run_ios_tests_tc
|
|
system('bundle exec cucumber OS=ios FF=tablet features -t @ios -f TeamCityFormatter::Formatter -f html -o reports/report.html')
|
|
end
|
|
|
|
task :Nexus_9_Device do
|
|
run_android_tests_tc
|
|
end
|
|
|
|
task :iPad_mini_Device do
|
|
run_ios_tests_tc
|
|
end
|
|
|
|
multitask test_android: [:Nexus_9_Device] do
|
|
puts 'Running Android devices automation'
|
|
end
|
|
|
|
multitask test_ios: [:iPad_mini_Device] do
|
|
puts 'Running iOS devices automation'
|
|
end
|