def test_bugfix_type_match(self): testcase_file_path = os.path.join(os.getcwd(), 'tests/data/test_bugfix.yml') testcases = testcase.load_file(testcase_file_path) config_dict = {"path": testcase_file_path} self.test_runner.init_config(config_dict, "testset") test = testcases[2]["test"] self.test_runner.run_test(test)
def test_load_csv_file_one_parameter(self): csv_file_path = os.path.join(os.getcwd(), 'tests/data/user_agent.csv') csv_content = testcase.load_file(csv_file_path) self.assertEqual(csv_content, [{ 'user_agent': 'iOS/10.1' }, { 'user_agent': 'iOS/10.2' }, { 'user_agent': 'iOS/10.3' }])
def test_load_yaml_testcases(self): testcase_file_path = os.path.join( os.getcwd(), 'tests/data/demo_testset_hardcode.yml') testcases = testcase.load_file(testcase_file_path) self.assertEqual(len(testcases), 3) test = testcases[0]["test"] self.assertIn('name', test) self.assertIn('request', test) self.assertIn('url', test['request']) self.assertIn('method', test['request'])
def test_load_csv_file_multiple_parameters(self): csv_file_path = os.path.join( os.getcwd(), 'tests/data/account.csv') csv_content = testcase.load_file(csv_file_path) self.assertEqual( csv_content, [ {'username': '******', 'password': '******'}, {'username': '******', 'password': '******'}, {'username': '******', 'password': '******'} ] )
def test_run_single_testcase(self): for testcase_file_path in self.testcase_file_path_list: testcases = testcase.load_file(testcase_file_path) config_dict = {"path": testcase_file_path} self.test_runner.init_config(config_dict, "testset") test = testcases[0]["test"] self.test_runner.run_test(test) test = testcases[1]["test"] self.test_runner.run_test(test) test = testcases[2]["test"] self.test_runner.run_test(test)
def setUp(self): self.context = Context() testcase_file_path = os.path.join(os.getcwd(), 'tests/data/demo_binds.yml') self.testcases = testcase.load_file(testcase_file_path)
def test_load_testcases_bad_filepath(self): testcase_file_path = os.path.join(os.getcwd(), 'tests/data/demo') with self.assertRaises(FileNotFoundError): testcase.load_file(testcase_file_path)