Home | History | Annotate | Download | only in java
      1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      2 
      3 <html>
      4     <head>
      5     <title>DTD for TestNG 1.0</title>
      6         <link rel="stylesheet" href="http://beust.com/beust.css" type="text/css"/>
      7     </head>
      8 <body>
      9 
     10 <pre class="code"><span class="xml-comment">&lt;!--
     11 
     12 Here is a quick overview of the main parts of this DTD.  For more information,
     13 refer to the &lt;a <span class="attribute">href="http://testng.org"</span> &gt;main web site<span class="tag">&lt;/a&gt;.
     14 
     15 </span>                                                      
     16 A <span class="tag">&lt;b&gt;suite&lt;/b&gt;</span> is made of <span class="tag">&lt;b&gt;tests&lt;/b&gt;</span> and <span class="tag">&lt;b&gt;parameters&lt;/b&gt;.
     17 </span>                                                      
     18 
     19 A <span class="tag">&lt;b&gt;test&lt;/b&gt;</span> is made of three parts:                        
     20 
     21 <span class="tag">&lt;ul&gt;
     22 &lt;li&gt;</span> <span class="tag">&lt;b&gt;parameters&lt;/b&gt;,</span> which override the suite parameters     
     23 <span class="tag">&lt;li&gt;</span> <span class="tag">&lt;b&gt;groups&lt;/b&gt;,</span> made of two parts                           
     24 
     25 <span class="tag">&lt;li&gt;</span> <span class="tag">&lt;b&gt;classes&lt;/b&gt;,</span> defining which classes are going to be part
     26   of this test run                                    
     27 <span class="tag">&lt;/ul&gt;
     28 </span>                                                      
     29 In turn, <span class="tag">&lt;b&gt;groups&lt;/b&gt;</span> are made of two parts:                
     30 
     31 <span class="tag">&lt;ul&gt;
     32 &lt;li&gt;</span> Definitions, which allow you to group groups into   
     33   bigger groups                                       
     34 <span class="tag">&lt;li&gt;</span> Runs, which defines the groups that the methods     
     35   must belong to in order to be run during this test  
     36 <span class="tag">&lt;/ul&gt;
     37 </span>                                                      
     38 Cedric Beust & Alexandru Popescu                      
     39 @title DTD for TestNG                                    
     40 @root suite
     41 
     42 --&gt;</span>
     43 
     44 
     45 <span class="xml-comment">&lt;!-- A suite is the top-level element of a testng.xml file                  --&gt;</span>
     46 
     47 &lt;!ELEMENT suite (listeners|packages|test|parameter|method-selectors|suite-files)* &gt;
     48 
     49 <span class="xml-comment">&lt;!-- Attributes: --&gt;</span>
     50 <span class="xml-comment">&lt;!--
     51 @attr  name        The name of this suite (as it will appear in the reports)
     52 @attr  junit       Whether to run in JUnit mode.
     53 @attr  verbose     How verbose the output on the console will be.  
     54                 This setting has no impact on the HTML reports.
     55 @attr  parallel   Whether TestNG should use different threads
     56                 to run your tests (might speed up the process)
     57 @attr  configfailurepolicy  Whether to continue attempting Before/After
     58                 Class/Methods after they've failed once or just skip remaining.
     59 @attr  thread-count An integer giving the size of the thread pool to use
     60                 if you set parallel.
     61 @attr  annotations  If "javadoc", TestNG will look for
     62                 JavaDoc annotations in your sources, otherwise it will
     63                 use JDK5 annotations.
     64 @attr  time-out     The time to wait in milliseconds before aborting the
     65                 method (if <span class="attribute">parallel="methods"</span> ) or the test (parallel="tests")
     66 @attr  skipfailedinvocationCounts Whether to skip failed invocations.
     67 @attr  data-provider-thread-count An integer giving the size of the thread pool to use
     68        for parallel data providers.
     69 @attr  object-factory A class that implements IObjectFactory that will be used to
     70        instantiate the test objects.
     71 --&gt;</span>
     72 &lt;!ATTLIST suite 
     73     name CDATA #REQUIRED
     74     junit (true | false) "false"
     75     verbose CDATA #IMPLIED
     76     parallel (false | methods | tests | classes) "false"
     77     configfailurepolicy (skip | continue) "skip"
     78     thread-count CDATA "5"
     79     annotations CDATA #IMPLIED
     80     time-out CDATA #IMPLIED
     81     skipfailedinvocationCounts (true | false) "false"
     82     data-provider-thread-count CDATA "10"
     83     object-factory CDATA #IMPLIED
     84 &gt;
     85 
     86 <span class="xml-comment">&lt;!-- A list of XML files that contain more suite descriptions --&gt;</span>
     87 &lt;!ELEMENT suite-files (suite-file)* &gt;
     88 
     89 &lt;!ELEMENT suite-file ANY &gt;
     90 &lt;!ATTLIST suite-file
     91     path CDATA #REQUIRED
     92 &gt;
     93 
     94 <span class="xml-comment">&lt;!--
     95 Parameters can be defined at the <span class="tag">&lt;suite&gt;</span> or at the <span class="tag">&lt;test&gt;</span> level.
     96 Parameters defined at the <span class="tag">&lt;test&gt;</span> level override parameters of the same name in <span class="tag">&lt;suite&gt;
     97 
     98 Parameters</span> are used to link Java method parameters to their actual value, defined here.
     99 --&gt;</span>
    100 &lt;!ELEMENT parameter ANY&gt;
    101 &lt;!ATTLIST parameter
    102     name CDATA #REQUIRED
    103     value CDATA #REQUIRED &gt;
    104 
    105 <span class="xml-comment">&lt;!--
    106 Method selectors define user classes used to select which methods to run.
    107 They need to implement <span class="tag">&lt;tt&gt;org.testng.IMethodSelector&lt;/tt&gt;</span> 
    108 --&gt;</span>
    109 &lt;!ELEMENT method-selectors (method-selector*) &gt;
    110 
    111 &lt;!ELEMENT method-selector ((selector-class)*|script) &gt;
    112 &lt;!ELEMENT selector-class ANY&gt;
    113 &lt;!ATTLIST selector-class
    114     name CDATA #REQUIRED
    115   priority CDATA #IMPLIED
    116 &gt;
    117 &lt;!ELEMENT script ANY&gt;
    118 &lt;!ATTLIST script
    119     language CDATA #REQUIRED
    120 &gt;
    121 
    122 <span class="xml-comment">&lt;!--
    123 A test contains parameters and classes.  Additionally, you can define additional groups ("groups of groups")
    124 --&gt;</span>
    125 
    126 &lt;!ELEMENT test (method-selectors?,parameter*,groups?,packages?,classes?) &gt;
    127 
    128 <span class="xml-comment">&lt;!--
    129 @attr  name         The name of this test (as it will appear in the reports)
    130 @attr  junit        Whether to run in JUnit mode.
    131 @attr  verbose      How verbose the output on the console will be.
    132                 This setting has no impact on the HTML reports.
    133                 Default value: suite level verbose.
    134 @attr  parallel     Whether TestNG should use different threads
    135                 to run your tests (might speed up the process)
    136 @attr  thread-count An integer giving the size of the thread pool to be used if
    137                 parallel mode is used. Overrides the suite level value.
    138 @attr  annotations  If "javadoc", TestNG will look for
    139                 JavaDoc annotations in your sources, otherwise it will
    140                 use JDK5 annotations.
    141 @attr  time-out     the time to wait in milliseconds before aborting
    142                 the method (if <span class="attribute">parallel="methods"</span> ) or the test (if <span class="attribute">parallel="tests"</span> )
    143 @attr  enabled      flag to enable/disable current test. Default value: true 
    144 @attr  skipfailedinvocationCounts Whether to skip failed invocations.
    145 --&gt;</span>
    146 &lt;!ATTLIST test
    147     name CDATA #REQUIRED 
    148     junit (true | false) "false"
    149     verbose  CDATA #IMPLIED
    150     parallel  CDATA #IMPLIED
    151     thread-count CDATA #IMPLIED
    152     annotations  CDATA #IMPLIED
    153     time-out CDATA #IMPLIED
    154     enabled CDATA #IMPLIED
    155     skipfailedinvocationCounts (true | false) "false"
    156 &gt;
    157 
    158 <span class="xml-comment">&lt;!--
    159 Defines additional groups ("groups of groups") and also which groups to include in this test run
    160 --&gt;</span>
    161 &lt;!ELEMENT groups (define*,run?) &gt;
    162 
    163 &lt;!ELEMENT define (include*)&gt;
    164 
    165 &lt;!ATTLIST define
    166     name CDATA #REQUIRED&gt;
    167 
    168 <span class="xml-comment">&lt;!-- Defines which groups to include in the current group of groups         --&gt;</span>
    169 &lt;!ELEMENT include ANY&gt;
    170 &lt;!ATTLIST include
    171     name CDATA #REQUIRED&gt;
    172 
    173 <span class="xml-comment">&lt;!-- Defines which groups to exclude from the current group of groups       --&gt;</span>
    174 &lt;!ELEMENT exclude ANY&gt;
    175 &lt;!ATTLIST exclude
    176     name CDATA #REQUIRED&gt;
    177 
    178 <span class="xml-comment">&lt;!-- The subtag of groups used to define which groups should be run         --&gt;</span>
    179 &lt;!ELEMENT run (include?,exclude?)* &gt;
    180 
    181 <span class="xml-comment">&lt;!-- The list of classes to include in this test                            --&gt;</span>
    182 &lt;!ELEMENT classes (class*) &gt;
    183 &lt;!ELEMENT class (methods*) &gt;
    184 &lt;!ATTLIST class
    185     name CDATA #REQUIRED &gt;
    186 
    187 <span class="xml-comment">&lt;!-- The list of packages to include in this test                           --&gt;</span>
    188 &lt;!ELEMENT packages (package*) &gt;
    189 
    190 <span class="xml-comment">&lt;!-- The package description. 
    191      If the package name ends with .* then subpackages are included too.
    192 --&gt;</span>
    193 &lt;!ELEMENT package (include?,exclude?)*&gt;
    194 &lt;!ATTLIST package
    195     name CDATA #REQUIRED &gt;
    196 
    197 <span class="xml-comment">&lt;!-- The list of methods to include/exclude from this test                 --&gt;</span>
    198 &lt;!ELEMENT methods (include?,exclude?)* &gt;
    199 
    200 <span class="xml-comment">&lt;!-- The list of listeners that will be passed to TestNG --&gt;</span>
    201 &lt;!ELEMENT listeners (listener*) &gt;
    202 
    203 &lt;!ELEMENT listener ANY&gt;
    204 &lt;!ATTLIST listener
    205     class-name CDATA #REQUIRED &gt;
    206 </pre>
    207