Re: "Failed to locate fixture" nunit-console with simpletest case
"Josh Szepietowski" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks for the advice. I wish I could have 'unsent' the email, as I landed on the same conclusion ( that $() macros do not work in the command line in C# ). Used to VC++ so this inconsistency got me by surprise. I ended up using a solution #4, which was to use nunit-console.exe from a post-build-process step (in the this area, I can use the $() macros). It works pretty well. One request coming out of this experience (please let me know if this is the wrong place to post, and I will clean it up and repost it wherever is more appropriate): 1) If the fixture is not found (which is apparently what the case was here, given it was trying to load "($TargetPath)"), giving a more descriptive result would be great. The 'Unable to locate fixture' makes sense in hind-sight, but when I saw it originally the fixture==file connection was lost, and I had assumed it loaded the file, but could not locate a fixture within the assembly. Perhaps a "Target File could not be located" would be great. A follow up question, any way I can setup this post-build step such that I can debug the tests as they are run? On Dec 23, 2007 9:37 AM, Charlie Poole <[email protected]> wrote: > H Josh, > > I'll tell you how to make your approach work land then suggest some > different approaches you may prefer. > > Running NUnit as the debug program is a good way run your tests within > Visual Studio. However, you can't I don't believe that you can use macros > like $(TargetPath) as a part of the working directory entry in the Debug > properties dialog, the way you can when setting up an external tool. The > solution is to hard code the path to your test assembly. To make it easier, > I generally set the working directory to the location of the assembly and > just put it's name and any options on the command line. > > Alternatives: > 1) Set up an external tool that runs tests on the current project. Note > however that some of the macros point to the obj directory - be sure you are > running the copy of the test assembly in the bin directory. > > 2) Run the NUnit gui along with Visual Studio and set it to automatically > run the tests each time the assemblies change. This has the advantage of > only running the last tests you ran. > > 3) Run the NUnit gui as the Debug program with the /run option and a > hard-coded path > > Charlie > > ------------------------------ > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *Josh > Szepietowski > *Sent:* Sunday, December 23, 2007 12:35 AM > *To:* [email protected] > *Subject:* [Nunit-users] "Failed to locate fixture" nunit-console with > simpletest case > > Hi all, > > Just starting to check out NUnit and TDD in general. I want to get my > environment set up such that I have a solution containing: (1) Assembly I am > coding, (2) Test Assembly with NUnit tests, set to be the 'startup project' > and kicking off nunit-console on it's self when it is run. > > So to start this off I created a new Project (TestLibrary), added a > reference to the nunit.framework assembly, and added a single *.cs file > with this code: > ..................... > using System; > using NUnit.Framework ; > > namespace TestLibrary > { > [TestFixture] > public class TestFoo > { > [Test] > public void AssertTruePasses() > { > Assert.IsTrue(true); > } > } > } > ..................... > > Simple as I could think for my first test.. :) I then changed the project > properties for the TestLibrary assembly as such: > -Start Action: > -Start External Program: > C:\Program Files\NUnit 2.4.3\bin\nunit-console.exe > -Start Options: > -Command Line Arguments: > $(TargetPath) -Wait > > And I press 'F5' (go run!).. The nunit-console application runs, but fails > with the message: > Unable to locate fixture > > > So, can anyone help me figure out what I am doing wrong here? :) Sorry, > very new to this whole NUnit thing, and it is a little frusterating to run > into such immediate resistance. For the record, opening the > TestLibrary.dll assembly (debug version) in the nunit gui program works > fine and the test passes.. But it is import for me to integrate the tests > into my build step. > > Thanks, > > -- > Josh Szepietowski > http://www.goosey.info > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Nunit-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/nunit-users > > -- Josh Szepietowski http://www.goosey.info ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Nunit-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nunit-users