def test_if_each_test_should_be_own_suite(self): max_time = 5 tests_runtimes = [ ("test1", 5), ("test2", 4), ("test3", 3), ] suites = grs.divide_tests_into_suites(tests_runtimes, max_time) self.assertEqual(len(suites), 3)
def test_if_test_is_greater_than_max_it_goes_alone(self): max_time = 7 tests_runtimes = [ ("test1", 15), ("test2", 4), ("test3", 3), ] suites = grs.divide_tests_into_suites(tests_runtimes, max_time) self.assertEqual(len(suites), 2) self.assertEqual(suites[0].get_test_count(), 1) self.assertEqual(suites[0].get_runtime(), 15)
def test_if_less_total_than_max_only_one_suite_created(self): max_time = 20 tests_runtimes = [ ("test1", 5), ("test2", 4), ("test3", 3), ] suites = grs.divide_tests_into_suites(tests_runtimes, max_time) self.assertEqual(len(suites), 1) self.assertEqual(suites[0].get_test_count(), 3) self.assertEqual(suites[0].get_runtime(), 12)
def test_max_sub_suites_options(self): max_time = 5 max_suites = 2 tests_runtimes = [ ("test1", 5), ("test2", 4), ("test3", 3), ("test4", 4), ("test5", 3), ] suites = grs.divide_tests_into_suites(tests_runtimes, max_time, max_suites=max_suites) self.assertEqual(len(suites), max_suites) total_tests = 0 for suite in suites: total_tests += suite.get_test_count() self.assertEqual(total_tests, len(tests_runtimes))