I'm not talking so much about testing Nant itself, I understand how
that's done.

I'm talking about testing small portions of the script you are
developing.

If there's no good way of doing it, I can accept that, but I wonder if a
family of tasks could be created something along these lines:

<assert test="fileexists('fileIwantedcopied.output')"
depends="copytarget" />

for testing this target:
<target name="copytarget">
        <copy source="foo" destination="fileIwantedcopied.output" />
</target>

Note: I didn't look up the exact syntax of copy, so don't beat me up
about that...

The point is that you could test that what you wanted to happen did
happen. This would allow you to write tests first for your Nant script,
and do Test Driven Development (TDD) of Nant scripts. If TDD is good for
the development of Nant's C# code, wouldn't it also be good for Nant
Scripts too?

Several tasks would have to be created similar to the setup and teardown
and test functions of Nunit.

Any thoughts? 

Should I post this to the Nant developer's list?

-Kelly  

-----Original Message-----
From: Troy Laurin [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 12, 2005 6:49 PM
To: Anderson, Kelly
Cc: nant-users@lists.sourceforge.net
Subject: Re: [Nant-users] Unit Testing Nant Scripts

On 9/13/05, Anderson, Kelly <[EMAIL PROTECTED]> wrote:
> Does anyone have any idea about how to unit test Nant scripts? Is it 
> even possible?
> 
> -Kelly

Kelly,

There is unit testing in place for many (most?) NAnt tasks, which can be
found in the source distribution of NAnt.

There isn't really anything in place to unit test entire scripts...
that is probably more of a system test scenario, anyway.  I think that
most NAnt scripts would have side-effects that would make isolated unit
testing very difficult... have a look at the task unit tests though, and
see if they could be extended to test script parts for your use.


Hope that helps, at least a little,

--
Troy





E-Mail messages may contain viruses, worms, or other malicious code. By reading 
the message and opening any attachments, the recipient accepts full 
responsibility for taking protective action against such code. Sender is not 
liable for any loss or damage arising from this message.

The information in this e-mail is confidential and may be legally privileged. 
It is intended solely for the addressee(s). Access to this e-mail by anyone 
else is unauthorized.



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to