你能更好地解释一下 TestNG 的 @BeforeTest 注释的语义吗?

发布于 2024-10-05 21:15:05 字数 254 浏览 0 评论 0原文

我阅读了相关文档但不明白。另请参阅此问题

I read the relevant documentation and didn't understand it. See also this question.

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

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

发布评论

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

评论(1

俏︾媚 2024-10-12 21:15:05

要理解这一点,您必须理解 testng.xml。现在重读同样的事情,

将运行带注释的方法
在属于任何测试方法之前
标签内的类是
运行。

应该清楚的是,此注释仅适用于属于 testng.xml 标记下定义的类的方法。

To understand that, you must understand testng.xml. Now reread the same thing,

The annotated method will be run
before any test method belonging to
the classes inside the <test> tag is
run.

It should be clear that this annotation will only work with the methods those belong to the classes defined under <test> tag in testng.xml.

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