Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TestNG.xml suite to include all packages all files

Just about to implement a test framework with Maven+TestNG+Selenium.

How do you declare a suite.xml that tells TestNG to run ALL tests? I've tried all these to no avail:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Toplevel TestNG configuration" verbose="10">
  <test name="all">
    <classes>
      <class name="*" />
    </classes>
  </test>
</suite>

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Toplevel TestNG configuration" verbose="10">
  <test name="all">
    <groups>
      <run>
        <include name="*" />
        <exclude name="disabled" />
      </run>
    </groups>
  </test>
</suite>

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Toplevel TestNG configuration" verbose="10">
  <test name="all">
    <packages>
      <package name="*" />
    </packages>
  </test>
</suite>

I need to specify different suite configurations with different paramers but all running all tests. Every example I could dig up explicitely lists each class or package which makes less than zero sense to me.

like image 964
sibidiba Avatar asked Sep 18 '12 08:09

sibidiba


2 Answers

Should use .* to match them all as far as I know.

like image 81
luis Avatar answered Oct 11 '22 04:10

luis


You can add all test classes inside a package by declaring testng.xml file as

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="sampleTest" parallel="false">

    <test name="sample-Test" preserve-order="true" verbose="2">
        <packages>
            <package name="org.sample.something.*"/>
        </packages>
    </test>

</suite>

There is nowhere to pass tests as search options. If you want to do something like that you have to implement the suite in code and implement search scenario there.

like image 22
Dharshana Avatar answered Oct 11 '22 05:10

Dharshana