TestNG 的组

发布于 2024-08-28 12:11:47 字数 202 浏览 6 评论 0原文

如果我们有 ,TestNG 会运行属于 web 或周末。

是否可以更改此行为,以便 TestNG 运行属于网络周末的所有方法?有谁知道如何实现这一目标?

If we have <include name="web" > and <include name="weekend" >, TestNG runs all the methods that belong to either web or weekend.

Is it possible to change this behaviour so TestNG would run all the methods that belong to web and weekend? Does anyone knows a way to accomplish this?

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

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

发布评论

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

评论(2

绾颜 2024-09-04 12:11:47

是的,BeanShell 是一种方法。

如果您需要更复杂的东西,您可以使用 IMethodInterceptor,它基本上可以让您在 TestNG 开始处理所有测试方法之前重新排序它们。

这是一个示例:

http://beust. com/weblog/2008/03/29/test-method-priorities-in-testng/

Yes, BeanShell is one approach.

If you need something more sophisticated, you can use an IMethodInterceptor, which basically lets you reorder all the test methods before TestNG starts processing them.

Here is an example:

http://beust.com/weblog/2008/03/29/test-method-priorities-in-testng/

樱桃奶球 2024-09-04 12:11:47

我找到了解决方案。

我使用 beanshell 在 标记内编写我的条件。

像这样的东西:

 <method-selectors>
    <method-selector>
      <script language="beanshell"><![CDATA[
        (groups.containsKey(FIRST_GROUP) && groups.containsKey(SECOND_GROUP)) 
           ]]>
        </script>
     </method-selector>
    </method-selectors>

i've found a solution.

i used beanshell to script my conditions inside the <method-selector> tag.

something like:

 <method-selectors>
    <method-selector>
      <script language="beanshell"><![CDATA[
        (groups.containsKey(FIRST_GROUP) && groups.containsKey(SECOND_GROUP)) 
           ]]>
        </script>
     </method-selector>
    </method-selectors>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文