做了一下优化

This commit is contained in:
yushaoqi 2022-04-07 22:31:34 +08:00
parent 1d923c64e0
commit eeaa658593
26 changed files with 113 additions and 264 deletions

View File

@ -6851,3 +6851,22 @@
接口响应内容: {'status': 200, 'msg': '查询成功', 'content': ['yaml', '框架', 'jenkins', 'pytest', 'sdn', 'api'], 'ext': {'pytest': '', 'jenkins': '', 'api': '', 'sdn': '', '框架': '', 'yaml': ''}, 'error': False}
数据库断言数据: {'sql': None}
=================================================================================
%(levelname)-8s2022-04-07 22:30:12,617C:\work\Study\pytest-auto-api2\logs\info.log:run.py:22
_ _ _ _____ _
__ _ _ __ (_) / \ _ _| |_ __|_ _|__ ___| |_
/ _` | '_ \| | / _ \| | | | __/ _ \| |/ _ \/ __| __|
| (_| | |_) | |/ ___ \ |_| | || (_) | | __/\__ \ |_
\__,_| .__/|_/_/ \_\__,_|\__\___/|_|\___||___/\__|
|_|
开始执行余少琪的框架项目...
%(levelname)-8s2022-04-07 22:30:13,297C:\work\Study\pytest-auto-api2\logs\info.log:logDecorator.py:24
=================================================================================
测试标题: 测试接口
请求方式: POST
请求头: {'Content-Type': 'application/json;charset=UTF-8'}
请求路径: https://redisdatarecall.csdn.net/recommend/get_head_word
请求内容: {'bid': 'blog-121903028'}
接口响应内容: {'status': 200, 'msg': '查询成功', 'content': ['yaml', '框架', 'jenkins', 'pytest', 'sdn', 'api'], 'ext': {'pytest': '', 'jenkins': '', 'api': '', 'sdn': '', '框架': '', 'yaml': ''}, 'error': False}
数据库断言数据: {'sql': None}
=================================================================================

View File

@ -1,2 +1,2 @@
"Epic","Feature","Story","FAILED","BROKEN","PASSED","SKIPPED","UNKNOWN"
"这里是测试平台名称","这里是测试模块名称","这是一个测试的demo接口","0","1","0","0","0"
"这里是测试平台名称","这里是测试模块名称","这是一个测试的demo接口","0","0","1","0","0"

1 Epic Feature Story FAILED BROKEN PASSED SKIPPED UNKNOWN
2 这里是测试平台名称 这里是测试模块名称 这是一个测试的demo接口 0 1 0 0 1 0 0

View File

@ -8,14 +8,14 @@
"children" : [ {
"name" : "这是一个测试的demo接口",
"children" : [ {
"name" : "test_dateDemo[inData0]",
"uid" : "f55aa1e142fcf040",
"name" : "测试接口",
"uid" : "464098aa0ad3dcb2",
"parentUid" : "710e6e9c57cac41e6d6c86e7a2c6994d",
"status" : "broken",
"status" : "passed",
"time" : {
"start" : 1649341597527,
"stop" : 1649341597527,
"duration" : 0
"start" : 1649341813096,
"stop" : 1649341813299,
"duration" : 203
},
"flaky" : false,
"newFailed" : false,

View File

@ -1,2 +0,0 @@
"Category","FAILED","BROKEN","PASSED","SKIPPED","UNKNOWN"
"Test defects","0","1","0","0","0"
1 Category FAILED BROKEN PASSED SKIPPED UNKNOWN
Category FAILED BROKEN PASSED SKIPPED UNKNOWN
Test defects 0 1 0 0 0

View File

@ -1,30 +1,5 @@
{
"uid" : "4b4757e66a1912dae1a509f688f20b0f",
"name" : "categories",
"children" : [ {
"name" : "Test defects",
"children" : [ {
"name" : "AttributeError: 'RequestControl' object has no attribute 'HttpRequest'",
"children" : [ {
"name" : "test_dateDemo[inData0]",
"uid" : "f55aa1e142fcf040",
"parentUid" : "6223cb31c16802e96c5849954dbac69e",
"status" : "broken",
"time" : {
"start" : 1649341597527,
"stop" : 1649341597527,
"duration" : 0
},
"flaky" : false,
"newFailed" : false,
"newPassed" : false,
"newBroken" : false,
"retriesCount" : 0,
"retriesStatusChange" : false,
"parameters" : [ "{'url': 'https://redisdatarecall.csdn.net/recommend/get_head_word', 'method': 'POST', 'detail': '测试接口', 'headers': {'Content-Type': 'application/json;charset=UTF-8'}, 'requestType': 'params', 'allureEpic': '这里是测试平台名称', 'allureFeature': '这里是测试模块名称', 'data': {'bid': 'blog-121903028'}, 'resp': {'code': {'jsonpath': '$.status', 'type': '==', 'value': 200, 'AssertType': None}, 'msg': {'jsonpath': '$.msg', 'type': '==', 'value': '查询成功', 'AssertType': None}}, 'sql': None}" ]
} ],
"uid" : "6223cb31c16802e96c5849954dbac69e"
} ],
"uid" : "bdbf199525818fae7a8651db9eafe741"
} ]
"children" : [ ]
}

View File

@ -4,14 +4,14 @@
"children" : [ {
"name" : "test_case.test_demo.test_DateDemo",
"children" : [ {
"name" : "test_dateDemo[inData0]",
"uid" : "f55aa1e142fcf040",
"name" : "测试接口",
"uid" : "464098aa0ad3dcb2",
"parentUid" : "827511afb259d0c1cfc36fa1a8b41cc8",
"status" : "broken",
"status" : "passed",
"time" : {
"start" : 1649341597527,
"stop" : 1649341597527,
"duration" : 0
"start" : 1649341813096,
"stop" : 1649341813299,
"duration" : 203
},
"flaky" : false,
"newFailed" : false,

View File

@ -1,5 +1,5 @@
"Status","Start Time","Stop Time","Duration in ms","Parent Suite","Suite","Sub Suite","Test Class","Test Method","Name","Description"
"broken","Thu Apr 07 22:26:37 CST 2022","Thu Apr 07 22:26:37 CST 2022","0","test_case.test_demo","test_DateDemo","TestDateDemo","","","test_dateDemo[inData0]","
"passed","Thu Apr 07 22:30:13 CST 2022","Thu Apr 07 22:30:13 CST 2022","203","test_case.test_demo","test_DateDemo","TestDateDemo","","","测试接口","
测试接口
:param :
:return:

1 Status Start Time Stop Time Duration in ms Parent Suite Suite Sub Suite Test Class Test Method Name Description
2 broken passed Thu Apr 07 22:26:37 CST 2022 Thu Apr 07 22:30:13 CST 2022 Thu Apr 07 22:26:37 CST 2022 Thu Apr 07 22:30:13 CST 2022 0 203 test_case.test_demo test_DateDemo TestDateDemo test_dateDemo[inData0] 测试接口 测试接口 :param : :return:
3
4
5

View File

@ -8,14 +8,14 @@
"children" : [ {
"name" : "TestDateDemo",
"children" : [ {
"name" : "test_dateDemo[inData0]",
"uid" : "f55aa1e142fcf040",
"name" : "测试接口",
"uid" : "464098aa0ad3dcb2",
"parentUid" : "e20c9714c8ce4d88627f18182efe23fe",
"status" : "broken",
"status" : "passed",
"time" : {
"start" : 1649341597527,
"stop" : 1649341597527,
"duration" : 0
"start" : 1649341813096,
"stop" : 1649341813299,
"duration" : 203
},
"flaky" : false,
"newFailed" : false,

View File

@ -1,125 +0,0 @@
{
"uid" : "f55aa1e142fcf040",
"name" : "test_dateDemo[inData0]",
"fullName" : "test_case.test_demo.test_DateDemo.TestDateDemo#test_dateDemo",
"historyId" : "9724f0467ede83b4aa72aeced28d200a",
"time" : {
"start" : 1649341597527,
"stop" : 1649341597527,
"duration" : 0
},
"description" : "\n 测试接口\n :param :\n :return:\n ",
"descriptionHtml" : "<pre><code> 测试接口\n :param :\n :return:\n</code></pre>\n",
"status" : "broken",
"statusMessage" : "AttributeError: 'RequestControl' object has no attribute 'HttpRequest'",
"statusTrace" : "self = <test_DateDemo.TestDateDemo object at 0x00000264B8607D00>\ninData = {'allureEpic': '这里是测试平台名称', 'allureFeature': '这里是测试模块名称', 'data': {'bid': 'blog-121903028'}, 'detail': '测试接口', ...}\n\n @allure.story(\"这是一个测试的demo接口\")\n @pytest.mark.parametrize('inData', TestData)\n def test_dateDemo(self, inData):\n \"\"\"\n 测试接口\n :param :\n :return:\n \"\"\"\n \n> res = DateDemo().dateDemo(inData)\n\ntest_case\\test_demo\\test_DateDemo.py:30: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\ninData = {'allureEpic': '这里是测试平台名称', 'allureFeature': '这里是测试模块名称', 'data': {'bid': 'blog-121903028'}, 'detail': '测试接口', ...}\n\n @staticmethod\n def dateDemo(inData):\n \"\"\"\n 测试接口\n :param inData:\n :return:\n \"\"\"\n \n> resp = RequestControl().HttpRequest(inData['method'], inData)\nE AttributeError: 'RequestControl' object has no attribute 'HttpRequest'\n\nlib\\test_demo\\DateDemo.py:21: AttributeError",
"flaky" : false,
"newFailed" : false,
"newBroken" : false,
"newPassed" : false,
"retriesCount" : 0,
"retriesStatusChange" : false,
"beforeStages" : [ {
"name" : "_session_faker",
"time" : {
"start" : 1649341597421,
"stop" : 1649341597521,
"duration" : 100
},
"status" : "passed",
"steps" : [ ],
"attachments" : [ ],
"parameters" : [ ],
"hasContent" : false,
"stepsCount" : 0,
"shouldDisplayMessage" : false,
"attachmentsCount" : 0
}, {
"name" : "clear_report",
"time" : {
"start" : 1649341597521,
"stop" : 1649341597522,
"duration" : 1
},
"status" : "passed",
"steps" : [ ],
"attachments" : [ ],
"parameters" : [ ],
"hasContent" : false,
"stepsCount" : 0,
"shouldDisplayMessage" : false,
"attachmentsCount" : 0
} ],
"afterStages" : [ {
"name" : "clear_report::0",
"time" : {
"start" : 1649341597659,
"stop" : 1649341597659,
"duration" : 0
},
"status" : "passed",
"steps" : [ ],
"attachments" : [ ],
"parameters" : [ ],
"hasContent" : false,
"stepsCount" : 0,
"shouldDisplayMessage" : false,
"attachmentsCount" : 0
} ],
"labels" : [ {
"name" : "epic",
"value" : "这里是测试平台名称"
}, {
"name" : "story",
"value" : "这是一个测试的demo接口"
}, {
"name" : "feature",
"value" : "这里是测试模块名称"
}, {
"name" : "parentSuite",
"value" : "test_case.test_demo"
}, {
"name" : "suite",
"value" : "test_DateDemo"
}, {
"name" : "subSuite",
"value" : "TestDateDemo"
}, {
"name" : "host",
"value" : "DESKTOP-H35VFGJ"
}, {
"name" : "thread",
"value" : "11356-MainThread"
}, {
"name" : "framework",
"value" : "pytest"
}, {
"name" : "language",
"value" : "cpython3"
}, {
"name" : "package",
"value" : "test_case.test_demo.test_DateDemo"
}, {
"name" : "resultFormat",
"value" : "allure2"
} ],
"parameters" : [ {
"name" : "inData",
"value" : "{'url': 'https://redisdatarecall.csdn.net/recommend/get_head_word', 'method': 'POST', 'detail': '测试接口', 'headers': {'Content-Type': 'application/json;charset=UTF-8'}, 'requestType': 'params', 'allureEpic': '这里是测试平台名称', 'allureFeature': '这里是测试模块名称', 'data': {'bid': 'blog-121903028'}, 'resp': {'code': {'jsonpath': '$.status', 'type': '==', 'value': 200, 'AssertType': None}, 'msg': {'jsonpath': '$.msg', 'type': '==', 'value': '查询成功', 'AssertType': None}}, 'sql': None}"
} ],
"links" : [ ],
"hidden" : false,
"retry" : false,
"extra" : {
"severity" : "normal",
"retries" : [ ],
"categories" : [ {
"name" : "Test defects",
"matchedStatuses" : [ ],
"flaky" : false
} ],
"tags" : [ ]
},
"source" : "f55aa1e142fcf040.json",
"parameterValues" : [ "{'url': 'https://redisdatarecall.csdn.net/recommend/get_head_word', 'method': 'POST', 'detail': '测试接口', 'headers': {'Content-Type': 'application/json;charset=UTF-8'}, 'requestType': 'params', 'allureEpic': '这里是测试平台名称', 'allureFeature': '这里是测试模块名称', 'data': {'bid': 'blog-121903028'}, 'resp': {'code': {'jsonpath': '$.status', 'type': '==', 'value': 200, 'AssertType': None}, 'msg': {'jsonpath': '$.msg', 'type': '==', 'value': '查询成功', 'AssertType': None}}, 'sql': None}" ]
}

View File

@ -4,16 +4,16 @@
"children" : [ {
"name" : "DESKTOP-H35VFGJ",
"children" : [ {
"name" : "11356-MainThread",
"name" : "3524-MainThread",
"children" : [ {
"name" : "test_dateDemo[inData0]",
"uid" : "f55aa1e142fcf040",
"parentUid" : "4733a64d72c1a4566f8e25ace4b825e2",
"status" : "broken",
"name" : "测试接口",
"uid" : "464098aa0ad3dcb2",
"parentUid" : "28aa69294c134b08d927e3a8193d16b1",
"status" : "passed",
"time" : {
"start" : 1649341597527,
"stop" : 1649341597527,
"duration" : 0
"start" : 1649341813096,
"stop" : 1649341813299,
"duration" : 203
},
"flaky" : false,
"newFailed" : false,
@ -23,7 +23,7 @@
"retriesStatusChange" : false,
"parameters" : [ "{'url': 'https://redisdatarecall.csdn.net/recommend/get_head_word', 'method': 'POST', 'detail': '测试接口', 'headers': {'Content-Type': 'application/json;charset=UTF-8'}, 'requestType': 'params', 'allureEpic': '这里是测试平台名称', 'allureFeature': '这里是测试模块名称', 'data': {'bid': 'blog-121903028'}, 'resp': {'code': {'jsonpath': '$.status', 'type': '==', 'value': 200, 'AssertType': None}, 'msg': {'jsonpath': '$.msg', 'type': '==', 'value': '查询成功', 'AssertType': None}}, 'sql': None}" ]
} ],
"uid" : "4733a64d72c1a4566f8e25ace4b825e2"
"uid" : "28aa69294c134b08d927e3a8193d16b1"
} ],
"uid" : "bb564c754c163bdde4eb98a5e4dd6534"
} ]

View File

@ -1,12 +1,11 @@
launch_status failed=0 1649341599000000000
launch_status broken=1 1649341599000000000
launch_status passed=0 1649341599000000000
launch_status skipped=0 1649341599000000000
launch_status unknown=0 1649341599000000000
launch_time duration=0 1649341599000000000
launch_time min_duration=0 1649341599000000000
launch_time max_duration=0 1649341599000000000
launch_time sum_duration=0 1649341599000000000
launch_problems test_defects=1 1649341599000000000
launch_retries retries=0 1649341599000000000
launch_retries run=1 1649341599000000000
launch_status failed=0 1649341815000000000
launch_status broken=0 1649341815000000000
launch_status passed=1 1649341815000000000
launch_status skipped=0 1649341815000000000
launch_status unknown=0 1649341815000000000
launch_time duration=203 1649341815000000000
launch_time min_duration=203 1649341815000000000
launch_time max_duration=203 1649341815000000000
launch_time sum_duration=203 1649341815000000000
launch_retries retries=0 1649341815000000000
launch_retries run=1 1649341815000000000

View File

@ -1,12 +1,11 @@
launch_status_failed 0
launch_status_broken 1
launch_status_passed 0
launch_status_broken 0
launch_status_passed 1
launch_status_skipped 0
launch_status_unknown 0
launch_time_duration 0
launch_time_min_duration 0
launch_time_max_duration 0
launch_time_sum_duration 0
launch_problems_test_defects 1
launch_time_duration 203
launch_time_min_duration 203
launch_time_max_duration 203
launch_time_sum_duration 203
launch_retries_retries 0
launch_retries_run 1

View File

@ -1,5 +1,3 @@
[ {
"data" : {
"Test defects" : 1
}
"data" : { }
} ]

View File

@ -1,5 +1,5 @@
[ {
"data" : {
"duration" : 0
"duration" : 203
}
} ]

View File

@ -1,9 +1,9 @@
[ {
"data" : {
"failed" : 0,
"broken" : 1,
"broken" : 0,
"skipped" : 0,
"passed" : 0,
"passed" : 1,
"unknown" : 0,
"total" : 1
}

View File

@ -2,20 +2,19 @@
"9724f0467ede83b4aa72aeced28d200a" : {
"statistic" : {
"failed" : 0,
"broken" : 1,
"broken" : 0,
"skipped" : 0,
"passed" : 0,
"passed" : 1,
"unknown" : 0,
"total" : 1
},
"items" : [ {
"uid" : "f55aa1e142fcf040",
"status" : "broken",
"statusDetails" : "AttributeError: 'RequestControl' object has no attribute 'HttpRequest'",
"uid" : "464098aa0ad3dcb2",
"status" : "passed",
"time" : {
"start" : 1649341597527,
"stop" : 1649341597527,
"duration" : 0
"start" : 1649341813096,
"stop" : 1649341813299,
"duration" : 203
}
} ]
}

View File

@ -5,9 +5,9 @@
"name" : "这里是测试平台名称",
"statistic" : {
"failed" : 0,
"broken" : 1,
"broken" : 0,
"skipped" : 0,
"passed" : 0,
"passed" : 1,
"unknown" : 0,
"total" : 1
}

View File

@ -1,5 +1,3 @@
[ {
"data" : {
"Test defects" : 1
}
"data" : { }
} ]

View File

@ -1,15 +1,4 @@
{
"total" : 1,
"items" : [ {
"uid" : "bdbf199525818fae7a8651db9eafe741",
"name" : "Test defects",
"statistic" : {
"failed" : 0,
"broken" : 1,
"skipped" : 0,
"passed" : 0,
"unknown" : 0,
"total" : 1
}
} ]
"total" : 0,
"items" : [ ]
}

View File

@ -1,5 +1,5 @@
[ {
"data" : {
"duration" : 0
"duration" : 203
}
} ]

View File

@ -1,11 +1,11 @@
[ {
"uid" : "f55aa1e142fcf040",
"name" : "test_dateDemo[inData0]",
"uid" : "464098aa0ad3dcb2",
"name" : "测试接口",
"time" : {
"start" : 1649341597527,
"stop" : 1649341597527,
"duration" : 0
"start" : 1649341813096,
"stop" : 1649341813299,
"duration" : 203
},
"status" : "broken",
"status" : "passed",
"severity" : "normal"
} ]

View File

@ -1,9 +1,9 @@
[ {
"data" : {
"failed" : 0,
"broken" : 1,
"broken" : 0,
"skipped" : 0,
"passed" : 0,
"passed" : 1,
"unknown" : 0,
"total" : 1
}

View File

@ -1,11 +1,11 @@
[ {
"uid" : "f55aa1e142fcf040",
"name" : "test_dateDemo[inData0]",
"uid" : "464098aa0ad3dcb2",
"name" : "测试接口",
"time" : {
"start" : 1649341597527,
"stop" : 1649341597527,
"duration" : 0
"start" : 1649341813096,
"stop" : 1649341813299,
"duration" : 203
},
"status" : "broken",
"status" : "passed",
"severity" : "normal"
} ]

View File

@ -1,11 +1,11 @@
[ {
"uid" : "f55aa1e142fcf040",
"name" : "test_dateDemo[inData0]",
"uid" : "464098aa0ad3dcb2",
"name" : "测试接口",
"time" : {
"start" : 1649341597527,
"stop" : 1649341597527,
"duration" : 0
"start" : 1649341813096,
"stop" : 1649341813299,
"duration" : 203
},
"status" : "broken",
"status" : "passed",
"severity" : "normal"
} ]

View File

@ -5,9 +5,9 @@
"name" : "test_case.test_demo",
"statistic" : {
"failed" : 0,
"broken" : 1,
"broken" : 0,
"skipped" : 0,
"passed" : 0,
"passed" : 1,
"unknown" : 0,
"total" : 1
}

View File

@ -3,18 +3,18 @@
"testRuns" : [ ],
"statistic" : {
"failed" : 0,
"broken" : 1,
"broken" : 0,
"skipped" : 0,
"passed" : 0,
"passed" : 1,
"unknown" : 0,
"total" : 1
},
"time" : {
"start" : 1649341597527,
"stop" : 1649341597527,
"duration" : 0,
"minDuration" : 0,
"maxDuration" : 0,
"sumDuration" : 0
"start" : 1649341813096,
"stop" : 1649341813299,
"duration" : 203,
"minDuration" : 203,
"maxDuration" : 203,
"sumDuration" : 203
}
}