views:

32

answers:

1

My shop has a precedent of checking in 3rd party tools to source control and using relative paths in projects/builds to find everything. Also, as NUnit releases new versions there have been several versions of NUnit admitted to this 3rd party libraries section in source control, so that changing older tests wasn't necessary to start using newer versions.

However, Finalbuilder defines the path to nunit-console.exe in the Tools | Options menus, and not only does this path not use environment variables, but there's only one of it.

Is there some way I'm missing to supply a path to the NUnit action?

+2  A: 

You can do this in the BeforeAction script event (javaScript) :

var nunitOptions = GetOptionsObject("NUnit")
nunitOptions.NUnitLocation = FBVariables.MYUNITPATH

where MYUNITPATH is a FinalBuilder Project variable that points to nunit. Note that you should avoid relative paths for this since they are not fully supported due to the multithreaded nature of FB.

Vincent Parrett
Nice! That looks pretty slick--I'll give it a shot. I'm confused about the unsupportedness of relative paths due to multithreadedness though; I wouldn't normally correlate those two things. How do they conflict?
bwerks
Interesting. The event you suggest works lke a charm! However, if the NUnitLocation path is not set prior to executing the script, the script fails validation and never starts.
bwerks
Windows typically uses the current directory of an application to resolve relative paths. FinalBuilder is multi-threaded, so there is no guarantee of what the current directory will be. You might want to contact support or post on our forums, lots of FinalBuilder specific stuff there.
Vincent Parrett
Oh, validation is optional, you can turn it off.. it's really just designed to help beginners get their build process and environment configured.
Vincent Parrett
ps. don't forget to accept my answer thx.
Vincent Parrett
Hmm. I guess what I don't get is that single or multi-threaded, the application directory wouldn't change, would it? Also, on your mention I found the validation configuration in the options. Is there a way to disable validation per action or just for the entire project?
bwerks
The issue is that if multiple threads are running and are trying to resolve a relative path, they may be trying to resolve it relative to different base directories, the usual trick is to set the current directory and then call GetFullPathName : http://msdn.microsoft.com/en-us/library/aa364963%28VS.85%29.aspx
Vincent Parrett
You cannot disable validation for single actions, it's a global setting.
Vincent Parrett