mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 19:39:44 +08:00
fix #189: remove file path dependency
This commit is contained in:
@@ -21,7 +21,6 @@ class TestHttpRunner(ApiServerUnittest):
|
||||
self.testcase = {
|
||||
'name': 'testset description',
|
||||
'config': {
|
||||
'path': 'docs/data/demo-quickstart-2.yml',
|
||||
'name': 'testset description',
|
||||
'request': {
|
||||
'base_url': '',
|
||||
@@ -181,7 +180,7 @@ class TestHttpRunner(ApiServerUnittest):
|
||||
{
|
||||
"config": {
|
||||
"name": "test teardown hooks",
|
||||
'path': 'tests/httpbin/hooks.yml',
|
||||
"path": "tests/httpbin/hooks.yml"
|
||||
},
|
||||
"teststeps": [
|
||||
{
|
||||
@@ -217,7 +216,7 @@ class TestHttpRunner(ApiServerUnittest):
|
||||
{
|
||||
"name": "test teardown hooks",
|
||||
"config": {
|
||||
'path': 'tests/httpbin/hooks.yml',
|
||||
"path": "tests/httpbin/hooks.yml"
|
||||
},
|
||||
"teststeps": [
|
||||
{
|
||||
@@ -246,9 +245,7 @@ class TestHttpRunner(ApiServerUnittest):
|
||||
testcases = [
|
||||
{
|
||||
"name": "test teardown hooks",
|
||||
"config": {
|
||||
'path': 'tests/httpbin/hooks.yml',
|
||||
},
|
||||
"config": {},
|
||||
"teststeps": [
|
||||
{
|
||||
"name": "test teardown hooks",
|
||||
|
||||
@@ -246,7 +246,6 @@ class TestSuiteLoader(unittest.TestCase):
|
||||
def test_load_test_file_testcase(self):
|
||||
testcase = loader._load_test_file("tests/testcases/smoketest.yml")
|
||||
self.assertEqual(testcase["config"]["name"], "smoketest")
|
||||
self.assertEqual(testcase["config"]["path"], "tests/testcases/smoketest.yml")
|
||||
self.assertIn("device_sn", testcase["config"]["variables"][0])
|
||||
self.assertEqual(len(testcase["teststeps"]), 8)
|
||||
self.assertEqual(testcase["teststeps"][0]["name"], "get token")
|
||||
@@ -365,8 +364,6 @@ class TestSuiteLoader(unittest.TestCase):
|
||||
os.getcwd(), 'tests/data/demo_testset_hardcode.json')
|
||||
testset_list = loader.load_testcases(path)
|
||||
self.assertEqual(len(testset_list), 1)
|
||||
self.assertIn("path", testset_list[0]["config"])
|
||||
self.assertEqual(testset_list[0]["config"]["path"], path)
|
||||
self.assertEqual(len(testset_list[0]["teststeps"]), 3)
|
||||
testsets_list.extend(testset_list)
|
||||
|
||||
@@ -374,8 +371,6 @@ class TestSuiteLoader(unittest.TestCase):
|
||||
path = 'tests/data/demo_testset_hardcode.yml'
|
||||
testset_list = loader.load_testcases(path)
|
||||
self.assertEqual(len(testset_list), 1)
|
||||
self.assertIn("path", testset_list[0]["config"])
|
||||
self.assertIn(path, testset_list[0]["config"]["path"])
|
||||
self.assertEqual(len(testset_list[0]["teststeps"]), 3)
|
||||
testsets_list.extend(testset_list)
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@ class TestRunner(ApiServerUnittest):
|
||||
start_time = time.time()
|
||||
|
||||
config_dict = {
|
||||
"path": os.path.join(os.getcwd(), __file__),
|
||||
"name": "basic test with httpbin",
|
||||
"variables": self.debugtalk_module["variables"],
|
||||
"functions": self.debugtalk_module["functions"],
|
||||
@@ -130,7 +129,6 @@ class TestRunner(ApiServerUnittest):
|
||||
|
||||
def test_run_testset_with_hooks_modify_request(self):
|
||||
config_dict = {
|
||||
"path": os.path.join(os.getcwd(), __file__),
|
||||
"name": "basic test with httpbin",
|
||||
"variables": self.debugtalk_module["variables"],
|
||||
"functions": self.debugtalk_module["functions"],
|
||||
@@ -185,9 +183,7 @@ class TestRunner(ApiServerUnittest):
|
||||
],
|
||||
"teardown_hooks": ["${teardown_hook_sleep_N_secs($response, 2)}"]
|
||||
}
|
||||
config_dict = {
|
||||
"path": os.path.join(os.getcwd(), __file__)
|
||||
}
|
||||
config_dict = {}
|
||||
self.test_runner.init_config(config_dict, "testcase")
|
||||
|
||||
start_time = time.time()
|
||||
@@ -218,9 +214,7 @@ class TestRunner(ApiServerUnittest):
|
||||
],
|
||||
"teardown_hooks": ["${teardown_hook_sleep_N_secs($response, 2)}"]
|
||||
}
|
||||
config_dict = {
|
||||
"path": os.path.join(os.getcwd(), __file__)
|
||||
}
|
||||
config_dict = {}
|
||||
self.test_runner.init_config(config_dict, "testcase")
|
||||
|
||||
start_time = time.time()
|
||||
@@ -246,9 +240,7 @@ class TestRunner(ApiServerUnittest):
|
||||
testcase_file_path = os.path.join(
|
||||
os.getcwd(), 'tests/data/test_bugfix.yml')
|
||||
testcases = loader.load_file(testcase_file_path)
|
||||
config_dict = {
|
||||
"path": testcase_file_path
|
||||
}
|
||||
config_dict = {}
|
||||
self.test_runner.init_config(config_dict, "testcase")
|
||||
|
||||
test = testcases[2]["test"]
|
||||
|
||||
Reference in New Issue
Block a user