Commit c19b00f7 authored by Dominic Althaus's avatar Dominic Althaus
Browse files

change input-output task to the better

parent a5de3646
......@@ -43,38 +43,4 @@ class InputOutputTask < Task
errors.add(:stub, error) unless error.nil?
end
def create_test_structure_records
begin
Task.transaction do
self.test_suits.destroy_all
# TODO should I do .respond_to? :test_suit_names_for
test_suit = TestSuit.new
test_suit.name = DEFAULT_TESTSUIT_NAME
self.test_suits << test_suit
test_case = TestCase.new
test_case.name = DEFAULT_TESTCASE_NAME
test_case.points = 1
test_suit.test_cases << test_case
end
rescue => e
self.errors.add :test, e.to_s
throw(:abort)
end
end
def check_test_structure
error, details = self.test_runner.validate_test_structure self.test.current_path, self.stub.current_path
self.errors.add(:test, error) unless error.nil?
self.errors.add(:details, details) unless details.nil?
error, details = self.test_runner.validate_input_generator_structure self.test.current_path, self.input_generator.current_path
self.errors.add(:input_generator, error) unless error.nil?
self.errors.add(:details, details) unless details.nil?
end
end
......@@ -39,62 +39,7 @@ class SubmissionTask < Task
errors.add(:test, error) unless error.nil?
end
def check_test_structure
return if self.errors.any?
error = nil
begin
error, details = self.test_runner.validate_test_structure self.test.current_path, self.stub.current_path
rescue => e
logger.warn "#{e}\n#{e.backtrace.join("\n")}"
error = 'Test ist Fehlerhaft! Überprüfung der Teststruktur wurde mit Fehler beendet!'
end
self.errors.add(:test, error) unless error.nil?
self.errors.add(:details, details) unless details.nil?
end
def prepare_moss_run
self.build_moss_run
end
def create_test_structure_records
test_runner = self.test_runner
no_test_cases = true
begin
Task.transaction do
self.test_suits.destroy_all
test_suit_names = test_runner.test_suit_names_for(self)
test_suit_names.each do |test_suit_name|
test_cases = test_runner.test_cases_for_testsuit(self, test_suit_name)
if test_cases.any?
no_test_cases = false
test_suit = TestSuit.new
test_suit.name = test_suit_name
self.test_suits << test_suit
test_cases.each do |test_case_name, values|
test_case = TestCase.new
test_case.name = test_case_name
test_case.points = values['points']
# test_case.extras = values['extras'] # for future
test_suit.test_cases << test_case
end
end
end
if no_test_cases
raise 'Es konnten keine Testfälle gefunden werden!'
end
end
rescue => e
self.errors.add :test, e.to_s
throw(:abort)
end
end
end
......@@ -84,11 +84,58 @@ class Task < Group
end
def create_test_structure_records
raise 'Not Implemented!'
test_runner = self.test_runner
no_test_cases = true
begin
Task.transaction do
self.test_suits.destroy_all
test_suit_names = test_runner.test_suit_names_for(self)
test_suit_names.each do |test_suit_name|
test_cases = test_runner.test_cases_for_testsuit(self, test_suit_name)
if test_cases.any?
no_test_cases = false
test_suit = TestSuit.new
test_suit.name = test_suit_name
self.test_suits << test_suit
test_cases.each do |test_case_name, values|
test_case = TestCase.new
test_case.name = test_case_name
test_case.points = values['points']
# test_case.extras = values['extras'] # for future
test_suit.test_cases << test_case
end
end
end
if no_test_cases
raise 'Es konnten keine Testfälle gefunden werden!'
end
end
rescue => e
self.errors.add :test, e.to_s
throw(:abort)
end
end
def check_test_structure
raise 'Not implemented'
return if self.errors.any?
error = nil
# begin
error, details = self.test_runner.validate_test_structure self.test.current_path, self.stub.current_path
# rescue => e
# logger.warn "#{e}\n#{e.backtrace.join("\n")}"
# error = 'Test ist Fehlerhaft! Überprüfung der Teststruktur wurde mit Fehler beendet!'
# end
self.errors.add(:test, error) unless error.nil?
self.errors.add(:details, details) unless details.nil?
end
def revalidate_and_rerun_tests
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment