def test_run_singe_yaml(self): singe_api_yaml = os.path.join(os.path.dirname(__file__), "api", "get_login.yaml") result = run_yaml(singe_api_yaml) self.assertEqual(result[0], True) singe_api_yaml = os.path.join(os.path.dirname(__file__), "api", "get_homepage.yaml") result = run_yaml(singe_api_yaml) self.assertEqual(result[0], True)
def test_loader_single_yaml(self): single_testcase_yaml = os.path.join(os.path.dirname(__file__), "api", "get_homepage.yml") result=run_yaml(single_testcase_yaml) self.assertEqual(len(result), 1) self.assertEqual(result[0], True) single_testcase_yaml = os.path.join(os.path.dirname(__file__), "api", "api_login_submit.yml") result = run_yaml(single_testcase_yaml) self.assertEqual(len(result), 1) self.assertEqual(result[0], True)
def main(): """ API test: parse command line options and run commands. """ parser = argparse.ArgumentParser(description="hogwarts httprunner") parser.add_argument('-V', '--version', dest='version', action='store_true', help="show version") parser.add_argument('yaml_path', help="yaml file path") args = parser.parse_args() if len(sys.argv) == 1: # no argument passed parser.print_help() return 0 print("testpath---", args.yaml_path) success = run_yaml(args.yaml_path) return success
def test_run_single_jsonpath(self): singe_api_yaml = os.path.join(os.path.dirname(__file__), "api", "get_login_submit.yaml") result = run_yaml(singe_api_yaml) self.assertEqual(result[0], True)
def test_run_single_yaml_with_jsonpath(self): single_testcase_yaml = os.path.join(os.path.dirname(__file__), "api", "api_login_submit.yml") result = run_yaml(single_testcase_yaml) self.assertEqual(len(result), 1) self.assertEqual(result[0], True)
def test_run_testcase_yml(self): single_api_yml = os.path.join(os.path.dirname(__file__), "testcase", "mubu_login.yml") #print(single_api_yml) result =run_yaml(single_api_yml) self.assertEqual(len(result), 4)
def test_run_yaml_yaml(self): testcase_api_yaml = os.path.join(os.path.dirname(__file__), "testcase", "mubu_login.yaml") r= run_yaml(testcase_api_yaml) self.assertEqual(len(r),4)