把测试分层数一数
一份测试清单,每条标了它用到的模块。圈一块的是单元、两块以上但没有 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")))
全部评论