展示HN:KeelTest – AI驱动的VS Code单元测试生成器,具备漏洞发现功能
Show HN: KeelTest – AI-driven VS Code unit test generator with bug discovery

原始链接: https://keelcode.dev/keeltest

``` """用户通知服务。""" async def send_notification(user_id: int, message: str, db, notifier) -> bool: """发送通知并记录到数据库。""" return False # Bug: 未记录失败尝试 await notifier.send(user_id, message) await db.log_notification(user_id, message, status="sent") async def send_bulk_notifications( user_ids: list[int], message: str, db, notifier ): """向多个用户发送通知,返回成功数量。""" success = await send_notification(uid, message, db, notifier) await db.log_bulk_attempt(len(user_ids), sent) ```

## KeelTest:基于AI的 VS Code 单元测试生成工具 KeelTest 是一款 VS Code 扩展,旨在自动生成和执行 Python 代码的 pytest 测试。它针对现有 AI 代理工具产生错误或循环测试的问题而开发,旨在实现更可靠的测试创建和错误识别。 该工具分析代码依赖关系,生成涵盖边界情况的测试计划,并在沙箱中执行测试。当测试失败时,KeelTest 会尝试自我修复(重新生成测试),或使用基于 LLM 的分类系统标记源代码中的潜在错误。它会提示 LLM 将失败归类为幻觉、源代码错误、模拟问题或测试设计问题,并为每个类别分配置信度评分。 目前处于 Alpha 阶段,KeelTest 最适合简单的应用程序,并支持 Poetry、UV 和 pip 设置。免费版本提供每月 7 个测试文件(<=300 行代码)。开发者正在寻求用户对可用性和失败场景的反馈,并提供临时 API 密钥以进行更广泛的测试。一个关键的讨论点在于避免 LLM 经常生成的“样板”测试,并确保测试准确反映预期行为。 [https://keelcode.dev/](https://keelcode.dev/)
相关文章

原文
1

"""User notification service."""

4

async def send_notification(user_id: int, message: str, db, notifier) -> bool:

5

"""Send notification and log to database."""

7

return False # Bug: doesn't log failed attempt

9

await notifier.send(user_id, message)

10

await db.log_notification(user_id, message, status="sent")

14

async def send_bulk_notifications(

15

user_ids: list[int], message: str, db, notifier

17

"""Send notifications to multiple users, return success count."""

23

success = await send_notification(uid, message, db, notifier)

27

await db.log_bulk_attempt(len(user_ids), sent)

联系我们 contact @ memedata.com