문제

Consider the following TestNG configuration which runs all tests in the com.example.functional.* pacakge:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Functional1" verbose="1" >
  <test name="FunctionalTest"   >
    <packages>
      <package name="com.example.functional.*">
      </package>
    </packages>
  </test>
</suite>

In order to split the test job, some exclusion rules were added:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Functional1" verbose="1" >
  <test name="FunctionalTest"   >
    <packages>
      <package name="com.example.functional.*">
            <exclude name="com.example.functional.services.courier.*"></exclude>
            <exclude name="com.example.functional.optimization.*"></exclude>
            <exclude name="com.example.functional.initialization"></exclude>
            <exclude name="com.example.functional.tasks"></exclude>
      </package>
    </packages>
  </test>
</suite>

The excluded package are still being executed - any idea why the exclusions are ignored?

도움이 되었습니까?

해결책

The * is the problem. When excluding optimization.*, sub-packages of optimization are excluded, but optimization isn't.

Removing * from the exclude tags should do it:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Functional1" verbose="1" >
  <test name="FunctionalTest"   >
    <packages>
      <package name="com.example.functional.*">
            <exclude name="com.example.functional.services.courier"></exclude>
            <exclude name="com.example.functional.optimization"></exclude>
            <exclude name="com.example.functional.initialization"></exclude>
            <exclude name="com.example.functional.tasks"></exclude>
      </package>
    </packages>
  </test>
</suite>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top