# Execute the test suite
fun run do
set_env
show_status
if not toolcontext.test_dir.file_exists then
toolcontext.test_dir.mkdir
end
write_to_nit
compile
if failure != null then
for test_class in test_classes do
for case in test_class.test_cases do
case.fail "Compilation Error"
case.raw_output = failure
toolcontext.clear_progress_bar
toolcontext.show_unit(case)
end
end
show_status
print ""
return
end
toolcontext.info("Execute test-suite {mmodule.name}", 1)
for before_module in before_all do
before_module.run
toolcontext.clear_progress_bar
toolcontext.show_unit(before_module)
if before_module.error != null then
for test_class in test_classes do
for case in test_class.before_all do
case.fail "Nitunit Error: before module test failed"
toolcontext.clear_progress_bar
toolcontext.show_unit(case)
end
for case in test_class.test_cases do
case.fail "Nitunit Error: before module test failed"
toolcontext.clear_progress_bar
toolcontext.show_unit(case)
end
for case in test_class.after_all do
case.fail "Nitunit Error: before module test failed"
toolcontext.clear_progress_bar
toolcontext.show_unit(case)
end
end
for after_module in after_all do
after_module.fail "Nitunit Error: before module test failed"
toolcontext.clear_progress_bar
toolcontext.show_unit(after_module)
end
show_status
print ""
return
end
end
for test_class in test_classes do
for case in test_class.before_all do
case.run
toolcontext.clear_progress_bar
toolcontext.show_unit(case)
if case.error != null then
for scase in test_class.test_cases do
scase.fail "Nitunit Error: before class test failed"
toolcontext.clear_progress_bar
toolcontext.show_unit(scase)
end
for scase in test_class.after_all do
scase.fail "Nitunit Error: before class test failed"
toolcontext.clear_progress_bar
toolcontext.show_unit(scase)
end
show_status
print ""
return
end
end
for case in test_class.test_cases do
case.run
toolcontext.clear_progress_bar
toolcontext.show_unit(case)
show_status
end
for after_class in test_class.after_all do
after_class.run
toolcontext.clear_progress_bar
toolcontext.show_unit(after_class)
show_status
end
end
for after_module in after_all do
after_module.run
toolcontext.clear_progress_bar
toolcontext.show_unit(after_module)
show_status
end
show_status
print ""
end
src/testing/testing_suite.nit:155,2--256,4