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"><!-- 11 12Here is a quick overview of the main parts of this DTD. For more information, 13refer to the <a <span class="attribute">href="http://testng.org"</span> >main web site<span class="tag"></a>. 14 15</span> 16A <span class="tag"><b>suite</b></span> is made of <span class="tag"><b>tests</b></span> and <span class="tag"><b>parameters</b>. 17</span> 18 19A <span class="tag"><b>test</b></span> is made of three parts: 20 21<span class="tag"><ul> 22<li></span> <span class="tag"><b>parameters</b>,</span> which override the suite parameters 23<span class="tag"><li></span> <span class="tag"><b>groups</b>,</span> made of two parts 24 25<span class="tag"><li></span> <span class="tag"><b>classes</b>,</span> defining which classes are going to be part 26 of this test run 27<span class="tag"></ul> 28</span> 29In turn, <span class="tag"><b>groups</b></span> are made of two parts: 30 31<span class="tag"><ul> 32<li></span> Definitions, which allow you to group groups into 33 bigger groups 34<span class="tag"><li></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"></ul> 37</span> 38Cedric Beust & Alexandru Popescu 39@title DTD for TestNG 40@root suite 41 42--></span> 43 44 45<span class="xml-comment"><!-- A suite is the top-level element of a testng.xml file --></span> 46 47<!ELEMENT suite (listeners|packages|test|parameter|method-selectors|suite-files)* > 48 49<span class="xml-comment"><!-- Attributes: --></span> 50<span class="xml-comment"><!-- 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--></span> 72<!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> 85 86<span class="xml-comment"><!-- A list of XML files that contain more suite descriptions --></span> 87<!ELEMENT suite-files (suite-file)* > 88 89<!ELEMENT suite-file ANY > 90<!ATTLIST suite-file 91 path CDATA #REQUIRED 92> 93 94<span class="xml-comment"><!-- 95Parameters can be defined at the <span class="tag"><suite></span> or at the <span class="tag"><test></span> level. 96Parameters defined at the <span class="tag"><test></span> level override parameters of the same name in <span class="tag"><suite> 97 98Parameters</span> are used to link Java method parameters to their actual value, defined here. 99--></span> 100<!ELEMENT parameter ANY> 101<!ATTLIST parameter 102 name CDATA #REQUIRED 103 value CDATA #REQUIRED > 104 105<span class="xml-comment"><!-- 106Method selectors define user classes used to select which methods to run. 107They need to implement <span class="tag"><tt>org.testng.IMethodSelector</tt></span> 108--></span> 109<!ELEMENT method-selectors (method-selector*) > 110 111<!ELEMENT method-selector ((selector-class)*|script) > 112<!ELEMENT selector-class ANY> 113<!ATTLIST selector-class 114 name CDATA #REQUIRED 115 priority CDATA #IMPLIED 116> 117<!ELEMENT script ANY> 118<!ATTLIST script 119 language CDATA #REQUIRED 120> 121 122<span class="xml-comment"><!-- 123A test contains parameters and classes. Additionally, you can define additional groups ("groups of groups") 124--></span> 125 126<!ELEMENT test (method-selectors?,parameter*,groups?,packages?,classes?) > 127 128<span class="xml-comment"><!-- 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--></span> 146<!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> 157 158<span class="xml-comment"><!-- 159Defines additional groups ("groups of groups") and also which groups to include in this test run 160--></span> 161<!ELEMENT groups (define*,run?) > 162 163<!ELEMENT define (include*)> 164 165<!ATTLIST define 166 name CDATA #REQUIRED> 167 168<span class="xml-comment"><!-- Defines which groups to include in the current group of groups --></span> 169<!ELEMENT include ANY> 170<!ATTLIST include 171 name CDATA #REQUIRED> 172 173<span class="xml-comment"><!-- Defines which groups to exclude from the current group of groups --></span> 174<!ELEMENT exclude ANY> 175<!ATTLIST exclude 176 name CDATA #REQUIRED> 177 178<span class="xml-comment"><!-- The subtag of groups used to define which groups should be run --></span> 179<!ELEMENT run (include?,exclude?)* > 180 181<span class="xml-comment"><!-- The list of classes to include in this test --></span> 182<!ELEMENT classes (class*) > 183<!ELEMENT class (methods*) > 184<!ATTLIST class 185 name CDATA #REQUIRED > 186 187<span class="xml-comment"><!-- The list of packages to include in this test --></span> 188<!ELEMENT packages (package*) > 189 190<span class="xml-comment"><!-- The package description. 191 If the package name ends with .* then subpackages are included too. 192--></span> 193<!ELEMENT package (include?,exclude?)*> 194<!ATTLIST package 195 name CDATA #REQUIRED > 196 197<span class="xml-comment"><!-- The list of methods to include/exclude from this test --></span> 198<!ELEMENT methods (include?,exclude?)* > 199 200<span class="xml-comment"><!-- The list of listeners that will be passed to TestNG --></span> 201<!ELEMENT listeners (listener*) > 202 203<!ELEMENT listener ANY> 204<!ATTLIST listener 205 class-name CDATA #REQUIRED > 206</pre> 207