在 Eclipse 中断言条件

发布于 2024-08-23 18:41:37 字数 198 浏览 3 评论 0原文

我用 eclipse 编写了一个junit测试, 要检查 Gui 组件状态,我使用断言: textfield.assert("expected message") 我正在搜索如何获取断言打印的错误消息 Eclipse 控制台中打印了一条消息,指出预期的文本与键入的文本不匹配 我喜欢收到此消息来生成报告 有没有一个简单的方法,我是一个 junit 方法?

I've write a junit test with eclipse ,
to check the Gui component status ,I use assert : textfield.assert("expected message")
i'm searching how to get the error message printed by assert
the message saying that the expected text doesn't match th typed text is printed in the eclipse console
I like to get this message to generate a report
is there an easy mean, my be a junit method ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

跨年 2024-08-30 18:41:37

它应该像这样:

assert("Bad output", expectedResults);

我会使用:

assertEquals("Bad output for # attempt", expectedResults, obtainedResults);

虽然

It should work out as something like:

assert("Bad output", expectedResults);

I'd use:

assertEquals("Bad output for # attempt", expectedResults, obtainedResults);

though

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文