[TOC]

如果testng.xml中的标记不足以满足您的需求,您可以使用BeanShell表达式来决定是否应将某个测试方法包含在测试运行中。

<test name="BeanShell test">
   <method-selectors>
     <method-selector>
       <script language="beanshell"><![CDATA[
         groups.containsKey("test1")
       ]]></script>
     </method-selector>
   </method-selectors>
  <!-- ... -->

当在testng.xml中找到