class Bucky::Core::TestCore::TestManager
Public Class Methods
new(test_cond)
click to toggle source
Keep test conditions and round number
# File lib/bucky/core/test_core/test_manager.rb, line 66 def initialize(test_cond) @test_cond = test_cond @re_test_count = @test_cond[:re_test_count] @tdo = Bucky::Core::Database::TestDataOperator.new @start_time = Time.now $job_id = @tdo.save_job_record_and_get_job_id(@start_time, @test_cond[:command_and_option]) end
Public Instance Methods
rerun()
click to toggle source
Rerun by job id
# File lib/bucky/core/test_core/test_manager.rb, line 79 def rerun rerun_job_id = @test_cond[:job] $round = @tdo.get_last_round_from_job_id(rerun_job_id) @test_cond[:re_test_cond] = @tdo.get_ng_test_cases_at_last_execution( is_error: 1, job_id: rerun_job_id, round: $round ) execute_test end
run()
click to toggle source
# File lib/bucky/core/test_core/test_manager.rb, line 74 def run execute_test end
Private Instance Methods
do_test_suites(test_suite_data)
click to toggle source
Generate and execute test
# File lib/bucky/core/test_core/test_manager.rb, line 100 def do_test_suites(test_suite_data) # For checking on linkstatus e2e_parallel_num = Bucky::Utils::Config.instance[:e2e_parallel_num] linkstatus_parallel_num = Bucky::Utils::Config.instance[:linkstatus_parallel_num] tcg = Bucky::Core::TestCore::TestClassGenerator.new(@test_cond) case @test_cond[:test_category][0] when 'e2e' then parallel_new_worker_each(test_suite_data, e2e_parallel_num) { |data| tcg.generate_test_class(data) } when 'linkstatus' then link_status_url_log = {} parallel_distribute_into_workers(test_suite_data, linkstatus_parallel_num) { |data| tcg.generate_test_class(data, link_status_url_log) } end end
execute_test()
click to toggle source
# File lib/bucky/core/test_core/test_manager.rb, line 113 def execute_test @re_test_count.times do |i| Bucky::Core::TestCore::ExitHandler.instance.reset $round = i + 1 test_suite_data = load_test_suites do_test_suites(test_suite_data) @test_cond[:re_test_cond] = @tdo.get_ng_test_cases_at_last_execution( is_error: 1, job_id: $job_id, round: $round ) break if @test_cond[:re_test_cond].empty? end end
load_test_suites()
click to toggle source
Load test suite from test code.
# File lib/bucky/core/test_core/test_manager.rb, line 91 def load_test_suites test_suite_data = Bucky::Core::TestCore::TestCaseLoader.load_testcode(@test_cond) raise StandardError, "\nThere is no test case!\nPlease check test condition." if test_suite_data.empty? @tdo.update_test_suites_data(test_suite_data) @tdo.add_suite_id_to_loaded_suite_data(test_suite_data) end