把测试分层数一数

👁️ 2 人浏览 💬 0 人评论 ❤️ 添加收藏

一份测试清单,每条标了它用到的模块。圈一块的是单元、两块以上但没有 handle 的是集成、有 handle 的是端到端。数一数各几条:

tests = {"test_parse_ok": ["parse"], "test_discount_edge": ["discount"], "test_store_report": ["Store", "report"], "test_parse_to_store": ["parse", "Store"], "test_full": ["handle"], "test_fmt": ["fmt"], "test_bad_line": ["handle"]}
layer = {}
for name, mods in tests.items():
    if "handle" in mods:
        layer[name] = "e2e"
    elif len(mods) == 1:
        layer[name] = "unit"
    else:
        layer[name] = "integration"
print(str(list(layer.values()).count("unit")) + "/" + str(list(layer.values()).count("integration")) + "/" + str(list(layer.values()).count("e2e")))
提交你的答案
请登录后提交答案。
去登录
代码编辑器
Ctrl + Enter 运行
本次输入:
输出:

                        
👩‍🏫
AI
💬 题目评论

全部评论