Ticket #673 (closed enhancement: invalid)
dojo ant test task
| Reported by: | jkuhnert@… | Owned by: | anonymous |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | TestFramework | Version: | 0.2 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
The attached patch makes it possible to use the dojo test system outside of the dojo project. The patch doesn't remove the old method of testing from build.xml, but does add the new one. If the patch is generally well recieved a much more all inclusive refactoring of the ant buildscripts for dojo could be accomplished.
The test task works almost exactly the same way the current dojo build does it, only it's more self contained (ie you ~only~ need the ant-dojotest.jar to run javascript unit tests). It also uses the Rhino API directly instead of executing it with -jar. This also has the added benefit of us being able to define more functionality in the executing runtime of the unit tests if it's decided we want to be able to test more things. It was painful becoming familiar with Rhino at first, but now that I know the API I don't think I'd have any problems extending it when needed.
Usage
To use the built ant-dojotest.jar ant task in dojo or any other project using ant as a build system you will need to add the following two sections to your build.xml file (this patch adds them to dojos build.xml already):
<taskdef name="dojo-test" classname="org.dojotoolkit.ant.DojoTestTask"
classpath="lib/ant-dojotest.jar" />
<target name="run-tests" depends="ant-tasks" >
<dojo-test dojosrc="your/path/to/dojo" testsrc="your/path/to/tests"/>
</target>
Applying/Testing Patch
The patch requires that two additional jars be added to your buildscripts/lib directory. They have been supplied on this ticket as well. (ant.jar / testng-4.7-jdk15.jar )
Note: The first time the task jar is built it won't be visible in your executing classpath, so you may need to invoke ant twice to get it resolved.
Available targets:
- ant-tasks - Compiles and creates dist/ant-dojotest.jar
- run-tests - Runs the standard dojo tests using the newly built task jar
- test-tasks - Compiles and runs the unit tests for the ant task (using testng )