mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-17 00:57:36 +08:00
refactor testcase config data structure
This commit is contained in:
@@ -165,12 +165,11 @@ class TestHttpRunner(ApiServerUnittest):
|
||||
self.assertLess(end_time - start_time, 60)
|
||||
|
||||
def test_run_httprunner_with_teardown_hooks_alter_response(self):
|
||||
config = {"name": "test teardown hooks"}
|
||||
config.update(loader.load_project_tests("tests"))
|
||||
testcases = [
|
||||
{
|
||||
"config": {
|
||||
"name": "test teardown hooks",
|
||||
"refs": loader.load_project_tests("tests")
|
||||
},
|
||||
"config": config,
|
||||
"teststeps": [
|
||||
{
|
||||
"name": "test teardown hooks",
|
||||
|
||||
@@ -240,7 +240,7 @@ class TestModuleLoader(unittest.TestCase):
|
||||
self.assertEqual(testcases[0]["config"]["name"], '123$var_a')
|
||||
self.assertIn(
|
||||
"sum_two",
|
||||
testcases[0]["config"]["refs"]["functions"]
|
||||
testcases[0]["config"]["functions"]
|
||||
)
|
||||
|
||||
|
||||
@@ -394,14 +394,14 @@ class TestSuiteLoader(unittest.TestCase):
|
||||
testcases_list = loader.load_tests(path)
|
||||
self.assertEqual(len(testcases_list), 1)
|
||||
self.assertEqual(len(testcases_list[0]["teststeps"]), 3)
|
||||
self.assertIn("get_sign", testcases_list[0]["config"]["refs"]["functions"])
|
||||
self.assertIn("get_sign", testcases_list[0]["config"]["functions"])
|
||||
|
||||
# relative file path
|
||||
path = 'tests/data/demo_testcase_hardcode.yml'
|
||||
testcases_list = loader.load_tests(path)
|
||||
self.assertEqual(len(testcases_list), 1)
|
||||
self.assertEqual(len(testcases_list[0]["teststeps"]), 3)
|
||||
self.assertIn("get_sign", testcases_list[0]["config"]["refs"]["functions"])
|
||||
self.assertIn("get_sign", testcases_list[0]["config"]["functions"])
|
||||
|
||||
# list/set container with file(s)
|
||||
path = [
|
||||
|
||||
Reference in New Issue
Block a user