Forgot the example ...

-----Original Message-----
From: Arnoldus, Michael [mailto:[EMAIL PROTECTED]]
Sent: 23. januar 2003 11:49
To: [EMAIL PROTECTED]
Subject: RE: [nant-dev] NUnit, Nant and current directory


I have written (and included) a small project that shows what I mean.

The generated test assembly can be run using the Nunit2 Gui testrunner,
where the test passes. Using nant I get the following result:

Buildfile: file:///C:/Documents and
Settings/marnoldus/Workspace/Dev/Nunit2WithF
ile/default.build

build:
     [echo] Build Directory is C:\Documents and
Settings\marnoldus\Workspace\Dev
\Nunit2WithFile/bin

test:
Tests run: 1, Failures: 1, Not run: 0, Time: 0,125 seconds

Failures:
1) Nant.Nunit2Test.FileTest.ReadFile : Could not find file "C:\Documents and
Set
tings\marnoldus\Workspace\Dev\SimpleFile.txt".
   at System.IO.__Error.WinIOError(Int32 errorCode, String str)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access,
FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean
bFr
omProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access,
FileShare share, Int32 bufferSize)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean
detec
tEncodingFromByteOrderMarks, Int32 bufferSize)
   at System.IO.StreamReader..ctor(String path)
   at System.IO.File.OpenText(String path)
   at Nant.Nunit2Test.FileTest.ReadFile() in C:\Documents and
Settings\marnoldus
\Workspace\Dev\Nunit2WithFile\FileTest.cs:line 15



BUILD FAILED
Tests Failed
Try 'nant -help' for more information

-----Original Message-----
From: Arnoldus, Michael [mailto:[EMAIL PROTECTED]]
Sent: 23. januar 2003 11:39
To: [EMAIL PROTECTED]
Subject: [nant-dev] NUnit, Nant and current directory


While I in principle can agree with the idea that code shouldn't depend on
the current
directory, I also think that the most important feature of the <nunit2> task
is that it should work the same way as the Nunit2 testrunner.

Lets say I want to use nant. I have chosen to adopt nunit2 and I have
already written some tests. These tests has to read a specific testfile
(which I only use for testing) that delivers inputdata to the test. This
testfile is placed in the project directory of the testproject. Naturally I
refer to the testfile using a relative path, 'cause I want my test to run
even if I move the project to a different directory. And happily Nunit2
thinks like me and changes the current directory to the directory where it
finds the test assembly. Everything works as I think it should. BUT - now I
want to nant and the <nunit2> task. But now my test fails, even though they
still work using the Nunit2 testrunner. This is not the experience I think
nant should deliver to its users.

Enjoy,

        Michael Arnoldus

-----Original Message-----
From: Scott Hernandez [mailto:[EMAIL PROTECTED]]
Sent: 20. januar 2003 04:49
To: Tomas Restrepo
Cc: [EMAIL PROTECTED]
Subject: Re: [nant-dev] NUnit Error With NAnt...


Yeah, I'm there with you, maybe some documentation would solve this problem.

Also, maybe this isn't the optimal solution, but we could add an option to
change the current directory if you want to have the current env dir set.

As long as we differ from the NUnit console/gui, there will be confusion and
complaints.

----- Original Message -----
From: "Tomas Restrepo" <[EMAIL PROTECTED]>
To: "Scott Hernandez" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, January 19, 2003 6:55 PM
Subject: Re: [nant-dev] NUnit Error With NAnt...


> Hi Scott,
>
> > True. It took me a little while to see this. But now I understand things
> > much better. And I think I better understand where some of the issues
are
> > coming from.
> >
> > In addition to the changes you made, I think we need to set the
> environment
> > working/current directory to the <nunit2> basedir. This will allow tests
> to
> > open files and work with IO related operations as they might expect.
Then
> > after the task finishes, we can set the current directory back. This is
a
> > process level change, so we kinda have to be careful.
>
> Actually, I struggled with this while making my changes... the original
> NUnit2.0 code does this, I think, but I believe this is fundamentally
wrong,
> and will actually end up "hiding" latent bugs.
>
> Let me put it this way: Any code that relies on the CurrentDir to be set
to
> a specific value at application startup is fundamentally broken, and
likely
> reveals the developer's not familiar with the real usage of the CurrentDir
> setting. If tests need to ensure the code has a known current directory
> before invoking the tested methods, they should explicitly set it
themselves
> or on the tests StartUp() routine.
>
> --
> Tomas Restrepo
> [EMAIL PROTECTED]
>
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
> are you planning your Web Server Security? Click here to get a FREE
> Thawte SSL guide and find the answers to all your  SSL security issues.
> http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
> _______________________________________________
> Nant-developers mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/nant-developers
>
>



-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Attachment: Nunit2WithFile.zip
Description: Binary data

Reply via email to