利用Apipost AI自动生成接口测试用例并批量执行
不少测试人员想了解,有没有不需要通过写代码,让AI快速生成接口测试用例和测试数据,并能够快速执行的方式?当下几个比较常用的接口测试工具,Apipost即具有这个能力,而且操作起来还很方便,完全是预期的功能效果,今天就给大家分享一下如何去实现。一、自动生成接口测试用例
1、操作入口
[*]进入Apipost,先将你要进行测试的接口导进来(很多种导入方式,如:导入cURL、导入接口文档让Ai自动识别等方式都可以)
[*]点击你要测试的接口,在主界面选择接口用例-AI数据池
[*]选择要进行生成用例的维度(就是需要验证哪些东西,如果不太清楚,可以全部勾选,看看效果先)
https://pic-out.zhimg.com/v2-fb9c38907794821802eaa1977cadf288~resize:1440:q75.png?animatedImageAutoPlay=false&animatedImagePlayCount=1&auth_key=1765529419-0-0-c412e093567c9fddb491829f9dfd0463&bizSceneCode=article_draft&expiration=1765529419&incremental=false&mid=720052902642129b1b31d1be9469c826&overTime=60&precoder=false&protocol=v2&retryCount=3&sampling=false&sceneCode=editor_copy_outbound&source=bfcaadb12、AI生成的接口用例效果
[*]
在上一步执行生成用例之后,就会自动生成各种维度的接口测试用例了
[*]
每个维度都生成了多条正向、反向接口用例,包含测试目的、期望结果和多组测试数据,建议可以检查一下,如果有不需要的可以进行删除或调整
https://pic-out.zhimg.com/v2-2e6bd6f89864c51b82147416f58f6fdd~resize:1440:q75.png?animatedImageAutoPlay=false&animatedImagePlayCount=1&auth_key=1765529419-0-0-aa6df8c501d8556d504e0778aec6fd86&bizSceneCode=article_draft&expiration=1765529419&incremental=false&mid=720052902642129b1b31d1be9469c826&overTime=60&precoder=false&protocol=v2&retryCount=3&sampling=false&sceneCode=editor_copy_outbound&source=bfcaadb1生成的部分测试数据
https://pic-out.zhimg.com/v2-df858053d1d1e4889903c5ab437f0cea~resize:1440:q75.png?animatedImageAutoPlay=false&animatedImagePlayCount=1&auth_key=1765529419-0-0-33ad4dc5905bcdcd7f49998be4602bc1&bizSceneCode=article_draft&expiration=1765529419&incremental=false&mid=720052902642129b1b31d1be9469c826&overTime=60&precoder=false&protocol=v2&retryCount=3&sampling=false&sceneCode=editor_copy_outbound&source=bfcaadb1生成多个维度的用例
https://pic-out.zhimg.com/v2-fa556ffe48786f115eaa6f19755c771d~resize:1440:q75.png?animatedImageAutoPlay=false&animatedImagePlayCount=1&auth_key=1765529419-0-0-ad6814a2bc5e995843ebf534f4635eb6&bizSceneCode=article_draft&expiration=1765529419&incremental=false&mid=720052902642129b1b31d1be9469c826&overTime=60&precoder=false&protocol=v2&retryCount=3&sampling=false&sceneCode=editor_copy_outbound&source=bfcaadb1二、执行批量接口测试用例
前面把接口用例生成完成之后,我们需要进行执行测试这些用例,验证接口是否符合预期,
当然,apipost也提供了快速对多条用例进行测试的功能,操作如下:
https://pic-out.zhimg.com/v2-fde9de029cec8b2913428d5ab896ecb6~resize:1440:q75.png?animatedImageAutoPlay=false&animatedImagePlayCount=1&auth_key=1765529419-0-0-bffc28ea47d818f1bf328e1485be1941&bizSceneCode=article_draft&expiration=1765529419&incremental=false&mid=720052902642129b1b31d1be9469c826&overTime=60&precoder=false&protocol=v2&retryCount=3&sampling=false&sceneCode=editor_copy_outbound&source=bfcaadb1点击**应用**:点击后保存测试用例到AI数据池中,并关闭当前界面。
点击**应用并测试**:点击后执行 应用 操作并开始进行接口用例测试,进入「执行测试用例界面」。
1、执行测试用例
进入执行测试用例界面,显示执行进度和执行的用例总数等信息,这里可能需要等一下(特别是用例比较多的情况,不过也蛮快的)
https://pic-out.zhimg.com/v2-3bfdc81793a04ecf110e186dfa3d385b~resize:1440:q75.png?animatedImageAutoPlay=false&animatedImagePlayCount=1&auth_key=1765529419-0-0-fcff28972b91969a8d05dfe2a38b1c8d&bizSceneCode=article_draft&expiration=1765529419&incremental=false&mid=720052902642129b1b31d1be9469c826&overTime=60&precoder=false&protocol=v2&retryCount=3&sampling=false&sceneCode=editor_copy_outbound&source=bfcaadb12、查看执行详情
每一条测试数据右侧会有一个 查看执行详情 按钮,点击后将打开二级抽屉「用例执行详情」,
展示包括测试结果、日志信息等。
可以在此页面进行编辑接口相关数据,进行 简单调试 ,重新执行测试,快速定位问题等操作
https://pic-out.zhimg.com/v2-6e690ae7aa7c22702b4e9426cf328f77~resize:1440:q75.png?animatedImageAutoPlay=false&animatedImagePlayCount=1&auth_key=1765529419-0-0-a6e0d5527ecedceaeff2bc94ff069390&bizSceneCode=article_draft&expiration=1765529419&incremental=false&mid=720052902642129b1b31d1be9469c826&overTime=60&precoder=false&protocol=v2&retryCount=3&sampling=false&sceneCode=editor_copy_outbound&source=bfcaadb1生成测试报告
当所有用例都执行完成之后,页面中将显示“AI生成报告” 按钮,点击后,AI将根据当前的执行信息,自动生成该次测试的详细测试报告结果
https://pic-out.zhimg.com/v2-f69c6163e0401b9a6bc1713f0715b666~resize:1440:q75.png?animatedImageAutoPlay=false&animatedImagePlayCount=1&auth_key=1765529419-0-0-d430c16d62ef253686a9c4525a546b2f&bizSceneCode=article_draft&expiration=1765529419&incremental=false&mid=720052902642129b1b31d1be9469c826&overTime=60&precoder=false&protocol=v2&retryCount=3&sampling=false&sceneCode=editor_copy_outbound&source=bfcaadb1测试报告内容包括:
测试概况:测试开始和结束时间、执行的测试用例数量等。
用例结果分析:每个测试用例的执行结果,以及智能分析结果。
测试结论:根据测试用例最终生成测试结论。
测试报告生成完成后,将自动被保存在 接口用例-测试报告 列表中,您可以随时查看或下载以供后续分析
三、将用例保存至AI用例池
apipost还支持把AI生成的用例数据都将存储在「AI用例数据池」中,方便下次进行复用等;
勾选对应的接口用例,可以通过 同步数据至常规数据池 功能将AI数据同步到常规数据池中,
进行批量执行或在自动化测试中进行引用执行。
https://pic-out.zhimg.com/v2-0adb59dc6af764118475322efc82fee8~resize:1440:q75.png?animatedImageAutoPlay=false&animatedImagePlayCount=1&auth_key=1765529419-0-0-fff970c09832d3ce19194657e916ab3d&bizSceneCode=article_draft&expiration=1765529419&incremental=false&mid=720052902642129b1b31d1be9469c826&overTime=60&precoder=false&protocol=v2&retryCount=3&sampling=false&sceneCode=editor_copy_outbound&source=bfcaadb1常规数据池
同步规则: 由于数据特殊性,我们默认最小生成维度是测试数据,即一条用例测试数据将生成常规用例池的一条测试用例
https://pic-out.zhimg.com/v2-aabc9ae80c27cfe873734368c20b4543~resize:1440:q75.png?animatedImageAutoPlay=false&animatedImagePlayCount=1&auth_key=1765529419-0-0-e571a183052e0e6335292a8416dcec50&bizSceneCode=article_draft&expiration=1765529419&incremental=false&mid=720052902642129b1b31d1be9469c826&overTime=60&precoder=false&protocol=v2&retryCount=3&sampling=false&sceneCode=editor_copy_outbound&source=bfcaadb1
来源:程序园用户自行投稿发布,如果侵权,请联系站长删除
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
页:
[1]