def test_run_single_testcase_with_paramerror_json(self): path = 'tests/testcase/param_without_url.json' json_testcase = loader.load_json_file(path) with pytest.raises(exceptions.ParamsError): runner.run_single_testcase(json_testcase)
def test_run_single_json_testcase_success(self): path = 'tests/testcase/smoke_test.json' json_testcase = loader.load_json_file(path) success, diff_content = runner.run_single_testcase(json_testcase) print(diff_content) assert success
def test_load_json_file_file_format_error(self): json_tmp_file = "tests/data/tmp.json" # create empty file with open(json_tmp_file, 'w') as f: f.write("") with self.assertRaises(exceptions.FileFormatError): loader.load_json_file(json_tmp_file) os.remove(json_tmp_file) # create empty json file with open(json_tmp_file, 'w') as f: f.write("{}") with self.assertRaises(exceptions.FileFormatError): loader.load_json_file(json_tmp_file) os.remove(json_tmp_file) # create invalid format json file with open(json_tmp_file, 'w') as f: f.write("abc") with self.assertRaises(exceptions.FileFormatError): loader.load_json_file(json_tmp_file) os.remove(json_tmp_file)
def test_load_json_file_format_error(self): json_tmp_file_path = 'tests/data/tmp.json' #create empty file with open(json_tmp_file_path, 'w') as f: f.write('') with pytest.raises(exceptions.FileFormatError): loader.load_json_file(json_tmp_file_path) #os.remove(json_tmp_file_path) # create empty json file with open(json_tmp_file_path, 'w') as f: f.write('{}') with pytest.raises(exceptions.FileFormatError): loader.load_json_file(json_tmp_file_path) #os.remove(json_tmp_file_path) # create invaild format json file with open(json_tmp_file_path, 'w') as f: f.write('abc') with pytest.raises(exceptions.FileFormatError): loader.load_json_file(json_tmp_file_path)