Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#673 closed enhancement (invalid)

dojo ant test task

Reported by: jkuhnert@… Owned by: anonymous
Priority: high Milestone:
Component: TestFramework Version: 0.2
Keywords: Cc:
Blocked By: Blocking:

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 )

Attachments (1)

dojo-anttest-patch.txt (31.2 KB) - added by jkuhnert@… 13 years ago.
The patch

Download all attachments as: .zip

Change History (4)

Changed 13 years ago by jkuhnert@…

Attachment: dojo-anttest-patch.txt added

The patch

comment:1 Changed 13 years ago by jkuhnert@…

The file sizes for the needed jars were too large to attach here, so you can dowload them directly via the following links:

http://tacos.sourceforge.net/ant.jar http://tacos.sourceforge.net/testng-4.7-jdk15.jar

comment:2 Changed 13 years ago by jkuhnert@…

Resolution: invalid
Status: newclosed

Patch is pretty stale now as quite a few changes have been made. Going to stick this somewhere else for now.

comment:3 Changed 12 years ago by (none)

Milestone: 0.4

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.