|
59 | 59 | <mkdir dir="${minify.dir}"/>
|
60 | 60 | <mkdir dir="${testoutput.dir}"/>
|
61 | 61 | <mkdir dir="${coveragereport.dir}"/>
|
| 62 | + |
| 63 | + <delete file="${basedir}/jsTestDriver.conf" failonerror="false"/> |
| 64 | + <delete file="${basedir}/jsTestDriverCoverage.conf" failonerror="false"/> |
62 | 65 | </target>
|
63 | 66 |
|
64 | 67 | <!-- Assembles the source parts into one file. -->
|
|
140 | 143 | <echo message="Exit the server by pressing Control-C in the java window."/>
|
141 | 144 | </target>
|
142 | 145 |
|
| 146 | + <target name="test-all" description="Runs the unit tests on all adapters. The server must be running (i.e. 'server')."> |
| 147 | + <!-- Param "testrun.name" used in echo output and to build a folder name where test result goes. --> |
| 148 | + <!-- Param "required.lib" specifies wich third-party lib is used while testing. --> |
| 149 | + <!-- Param "required.adapter" specifies the corresponding adapter that matches the lib. Leave unset for the built-in jquery support. --> |
| 150 | + |
| 151 | + <!-- jquery versions --> |
| 152 | + <antcall target="test-specific-lib"> |
| 153 | + <param name="testrun.name" value="jquery-1.6.2"/> |
| 154 | + <param name="required.lib" value="jquery-1.6.2.js"/> |
| 155 | + </antcall> |
| 156 | + <antcall target="test-specific-lib"> |
| 157 | + <param name="testrun.name" value="jquery-1.6.1"/> |
| 158 | + <param name="required.lib" value="jquery-1.6.1.js"/> |
| 159 | + </antcall> |
| 160 | + <antcall target="test-specific-lib"> |
| 161 | + <param name="testrun.name" value="jquery-1.5.2"/> |
| 162 | + <param name="required.lib" value="jquery-1.5.2.js"/> |
| 163 | + </antcall> |
| 164 | + |
| 165 | + <!-- mootools versions --> |
| 166 | + <antcall target="test-specific-lib"> |
| 167 | + <param name="testrun.name" value="mootools-1.3.2"/> |
| 168 | + <param name="required.lib" value="mootools-core-1.3.2-full-compat.js"/> |
| 169 | + <param name="required.adapter" value="js/adapters/mootools-adapter.src.js"/> |
| 170 | + </antcall> |
| 171 | + |
| 172 | + <!-- prototype versions --> |
| 173 | + <antcall target="test-specific-lib"> |
| 174 | + <param name="testrun.name" value="prototype-1.7.0.0"/> |
| 175 | + <param name="required.lib" value="prototype-1.7.0.0.js"/> |
| 176 | + <param name="required.adapter" value="js/adapters/prototype-adapter.src.js"/> |
| 177 | + </antcall> |
| 178 | + </target> |
| 179 | + |
| 180 | + <target name="test" description="Runs the unit tests latest jquery. The server must be running (i.e. 'server')."> |
| 181 | + <antcall target="test-specific-lib"> |
| 182 | + <param name="testrun.name" value="jquery-1.6.2"/> |
| 183 | + <param name="required.lib" value="jquery-1.6.2.js"/> |
| 184 | + </antcall> |
| 185 | + </target> |
| 186 | + |
| 187 | + <!-- Replace the lib with the specified ones, if set. --> |
| 188 | + <target name="replace-lib" if="required.lib"> |
| 189 | + <replace file="jsTestDriver.conf" token="#required.lib" value=" - lib/${required.lib}" summary="true"/> |
| 190 | + </target> |
| 191 | + |
| 192 | + <!-- Replace the adapter with the specified ones, if set. --> |
| 193 | + <target name="replace-adapter" if="required.adapter"> |
| 194 | + <replace file="jsTestDriver.conf" token="#required.adapter" value=" - ${required.adapter}" summary="true"/> |
| 195 | + </target> |
| 196 | + |
| 197 | + <target name="test-specific-lib" depends="set.properties"> |
| 198 | + <echo message="-----------------------------------------------"/> |
| 199 | + <echo message=" Running tests using: ${testrun.name}"/> |
| 200 | + <echo message="-----------------------------------------------"/> |
| 201 | + |
| 202 | + <!-- Copy the templated jsTestDriver configuration to root. --> |
| 203 | + <copy file="test/jsTestDriver.conf" todir="${basedir}" overwrite="true"/> |
| 204 | + |
| 205 | + <!-- Expand the tokens to valid js files. --> |
| 206 | + <antcall target="replace-lib"/> |
| 207 | + <antcall target="replace-adapter"/> |
| 208 | + |
| 209 | + <!-- Create the folder where the report is stored. --> |
| 210 | + <mkdir dir="${testoutput.dir}/${testrun.name}"/> |
| 211 | + |
| 212 | + <!-- Run the tests --> |
| 213 | + <antcall target="run-test"/> |
| 214 | + </target> |
| 215 | + |
143 | 216 | <!-- Runs the tests without coverage. This is much faster than with coverage enabled. -->
|
144 |
| - <target name="test" depends="set.properties" description="Runs the unit tests. The server must be running (i.e. 'server')."> |
| 217 | + <target name="run-test" depends="set.properties"> |
145 | 218 | <java jar="${jstestdriver.jar}" fork="true">
|
146 | 219 | <arg value="--config"/>
|
147 | 220 | <arg value="jsTestDriver.conf"/>
|
148 | 221 | <arg value="--testOutput"/>
|
149 |
| - <arg value="${testoutput.dir}"/> |
| 222 | + <arg value="${testoutput.dir}/${testrun.name}"/> |
150 | 223 | <arg value="--tests"/>
|
151 | 224 | <arg value="all"/>
|
152 | 225 | <arg value="--verbose"/>
|
|
157 | 230 | <!-- Starts the test driver server with coverage enabled. -->
|
158 | 231 | <!-- This must be done on a separate port to the test-server. -->
|
159 | 232 | <target name="server-coverage" depends="set.properties" description="Starts the unit test server with coverage enabled on localhost:5225.">
|
| 233 | + <!-- Copy the jsTestDriverCoverage configuration to root. --> |
| 234 | + <copy file="test/jsTestDriverCoverage.conf" todir="${basedir}" overwrite="true"/> |
| 235 | + |
160 | 236 | <exec executable="cmd" dir="${basedir}" >
|
161 | 237 | <arg value="/k start java -jar ${jstestdriver.jar} --config jsTestDriverCoverage.conf --port 5225"/>
|
162 | 238 | </exec>
|
|
167 | 243 |
|
168 | 244 | <!-- Runs coverage analysis for the tests. -->
|
169 | 245 | <target name="test-coverage" depends="set.properties" description="Runs the unit tests together with code coverage. The server must be running (i.e. 'server-coverage')">
|
| 246 | + <!-- Copy the jsTestDriverCoverage configuration to root. --> |
| 247 | + <copy file="test/jsTestDriverCoverage.conf" todir="${basedir}" overwrite="true"/> |
| 248 | + |
170 | 249 | <!-- Run the tests with coverage enabled. -->
|
171 | 250 | <java jar="${jstestdriver.jar}" fork="true">
|
172 | 251 | <arg value="--config"/>
|
|
0 commit comments