views:

1475

answers:

3

I have set my Visual Studio to start Nunit as an external program to run all the tests written in a module.

Now what I am trying to do is to create a batch file which will call Myproj.exe. What I am expecting is that it will run Nunit as I have set it to run an external program and execute all my tests in nunit.exe, but when I run that batch file it starts running from Visual Studio instead of opening NUnit.

Can any one please give me a clear idea as how to accomplish it?

I am too much stuck.


Now I am trying to run the following commands in shell

nunit-x86.exe Can you please tell how should I load my visualbasic project file (exe) here and then run all the tests from here as unable to execute following command

nunit nunit.tests.vbproj /config:release
A: 

you can just shell nunit.exe with the command line to your assembly to run tests in.

Tom Anderson
+1  A: 

You can make NUnit start everytime you debug your "NUnit tests".

You can attach the debugger in Visual Studio Express doing it that way. If you use a "full version" of VS do it that way:

Note that if you’re using the full and not the express version of Visual Studio 2005, you can do this by opening up the project’s properties, and in the Debug tab select Start External Program: and navigate to the NUnit executable, and set YourCompanyname.YourProject.Test.dll as the Command Line Arguments.

I got that ideas from this tutorial(Page 4/5) and love it.

Peter
That's a really good tutorial! Thanks for posting it.
Jonathan Webb
A: 

You can also run NUnit after every successful build in Visual Studio with a Post-Build Event.

In VS2005, right-click on the project that has your tests and select Properties. Then on the Build Events tab, in the "Post-build event command line", put this* to use the console:

nunit-console /xml:$(ProjectName).xml $(TargetPath)

or this to use the GUI::

nunit $(TargetPath) /run

In "Run the post-build event:", leave the default: "On successful build"

If you use the GUI, know that your build will appear to be hung up until you close the GUI app.

*NOTE: The nunit console command line docs say "By default the nunit-console program is not added to your path."

JeffH