def __get_testrail_testcases(tests): testcases = [] for testclass_obj, tests_list in tests.iteritems(): default_section = get_section(testclass_obj) default_suite = get_suite(testclass_obj) for test in tests_list: if test[1].__doc__ is not None: title = get_test_title(obj=test[1]) section = get_section(obj=test[1], default_section=default_section) suite = get_suite(obj=test[1], default_suite=default_suite) steps = get_test_steps(obj=test[1]) if can_create_testcase(title, suite, section, steps): testcases.append( TestRailTestCase(title=title, section=section, suite=suite, steps=steps)) return testcases
def __get_testrail_testcases(tests): testcases = [] for testclass_obj, tests_list in tests.iteritems(): default_section = get_section(testclass_obj) default_suite = get_suite(testclass_obj) for test in tests_list: if test[1].__doc__ is not None: title = get_test_title(obj=test[1]) section = get_section(obj=test[1], default_section=default_section) suite = get_suite(obj=test[1], default_suite=default_suite) steps = get_test_steps(obj=test[1]) if can_create_testcase(title, suite, section, steps): testcases.append( TestRailTestCase(title=title, section=section, suite=suite, steps=steps) ) return testcases
def test_get_steps_with_equals_sign(self): expected_steps = [ {'content': '- Get sixpack\n- Get friends\n- Get Playstation\n', 'expected': 'Fun in progress\nHardcore gaming\n'}] steps = get_test_steps(Tests.test_with_no_title) self.assertEqual(expected_steps, steps, "Steps must be '%s'. Got '%s' instead." % (expected_steps, steps))
def test_get_steps_without_steps_definition(self): steps = get_test_steps(Tests.test_without_steps) self.assertEqual(steps, [], "Steps must be 'None'. Got '%s' instead." % steps)
def test_get_steps_with_multiple_results(self): expected_steps = [{'content': '- Get friends\n- Get Playstation\n', 'expected': 'Fun in progress\n'}, {'content': '- Get sixpack\n', 'expected': 'ОР написано по-русски\n'}] steps = get_test_steps(Tests.test_steps_with_multiple_results) self.assertEqual(expected_steps, steps, "Steps must be '%s'. Got '%s' instead." % (expected_steps, steps))
def test_get_steps_without_result(self): expected_steps = [{'content': '- Get friends\n- Get Playstation\n', 'expected': ''}] steps = get_test_steps(Tests.test_steps_with_no_result) self.assertEqual(expected_steps, steps, "Steps must be '%s'. Got '%s' instead." % (expected_steps, steps))
def test_get_steps_without_docstring(self): steps = get_test_steps(Tests.this_is_not_test_method) self.assertIsNone(steps, "Steps must be 'None'. Got '%s' instead" % steps)
def test_get_steps(self): expected_steps = [{'content': '- Get friends\n- Get Playstation\n', 'expected': 'Fun in progress\n'}] steps = get_test_steps(Tests.test_something_cool) self.assertEqual(expected_steps, steps, "Steps must be '%s'. Got '%s' instead." % (expected_steps, steps))