nunit

Expect exceptions in nUnit without the ExpectedException attribute

Hi, I have methods with more than one parameter that are guarded against bad input by throwing ArgumentNullExceptions and ArgumentExceptions whenever any parameter is null. So there are two obvious ways to test this: One test per Parameter using the [ExpectedException] attribute One test for all parameters using multiple try{} catch b...

Is it possible to know when ReSharper's test runner is building my project?

I'm trying to use the MSBuild NUnit community task to force tests to run on each build, but I now see that when I use ReSharper's test runner and it builds the project I'm running the tests twice. It works but is not really desirable. Does anyone know of a variable or condition I can check within MSBuild so that I can skip the communit...

How to compensate for differences in environment between development machines and Build servers?

I have NUnit installed on my machine in "C:\Program Files\NUnit 2.4.8\" but on my integration server(running CruiseControl.Net) I have it installed in "D:\Program Files\NUnit 2.4.8\". The problem is that on my development machine my NAnt build file works correctly because in the task I'm using the path "C:\Program Files\NUnit 2.4.8\bin\...

NUnit "could not load file or assemby 'MyTestProject'

I'm setting up a new 64 bit machine to run as a build server. When I try to load my NUnit test assembly into NUnit GUI I get the following error. There is nothing obvious missing, all the dependencies seem to be present. All the DLLs are compiled for the x86 platform. Using NUnit 2.4.7. I have tried upgrading to 2.4.8 but the same er...

Visual Studio Unit Testing of Windows Forms

We're working on a project here in Visual Studio 2008. We're using the built-in testing suite provided with it (the Microsoft.VisualStudio.TestTools.UnitTesting namespace). It turns out, that much to our chagrin, a great deal of complexity (and therefore errors) have wound up coded into our UI layer. While our unit tests do a decent j...

Creating nunit tests without exporting them with the api

I'm new to unit testing using nunit (and Java development in general). When creating unit tests for private methods on classes, it looks as though the test file must be in the same package as the class being tested. What is the typical way of avoiding exporting the APIs of the unit tests? Can I make the classes/test methods package-pr...

Automatically wrap unit tests in DB transaction?

[Edit (Haren): Duplicate] I'm looking for a way to automatically wrap my NUnit integration tests in a DB transaction, so that changes made by the test are automatically rolled back when the test ends. Ideally, I would decorate certain test methods with a custom attribute that would cause NUnit to create a transaction when the test sta...

Writing an XmlSchema to a MemoryStream fails with an exception while runing from Nunit

Hi, I'm trying to convert an XmlSchema object to string. I'm building a simple XmlSchema, compiling it, and then converting it as folows: public string ConvertXmlSchemaToString(XmlSchema xmlSchema) { String SchemaAsString = String.Empty; // compile the schema XmlSchemaSet schemaSet = new XmlSchemaSet(); ...

Unit tests to test the Web methods of a Web service which does some database transactions using NUnit

How do I write unit tests to test the Web methods of a Web service using NUnit? The web methods in this application will add,update and delete a record in the database. The unit test will test a web method whether a record has been inserted in the database, the webmethod calls a method in data access layer to perform this action. ...

How to call Nunit from Visual Studio in a batch file

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...

Unable to load <mytest> Because it is not located under Appbase

I have created a nunit project(NunitLoginTest.nunit) by selcting my test project in the nunit\bin directory and now I am trying to load that project but it is giving me the following error. Unable to load Because it is not located under Appbase, could not load file or assembly "nunitLogintest" or one of its dependencies. The system can...

Reporting using NUnit

I want to have a managerial report after executing tests from NUnit. By looking into NUnit, It seems as it generates the output in XML format. Plz any one can give suggesttion of how to accomplish this. ...

timeout for individual test using Nunit

is there any way to implement timeout option for individual tests in a bunch of test executed on the ccnet. Mbunit and MSTest have [Timeout] attribute. I am looking for similar feature in Nunit. This is to avoid long running tests. ...

NUnit is executing All If statement evenif the condition fails

I am executing If statement based on some vales but Nunit executes all statements even if the condition is false ...

Need help moving nUnit tests into separate project

Everything works fine when the unit tests class is part of the main project (TestAccount). Every article I've read about unit testing recommends putting the tests in a separate project, so I... added another project (TestAccount.UnitTests) to the solution moved the unit tests class (AccountTests.vb) to TestAccount.UnitTests and ...

How to set up NUnit Mock Object for IGrouping

public myReturnObj MethodA(System.Linq.IGrouping<string, MyObject> group){ ... foreach (MyObject o in group) { //business process } ... return myReturnObj; } I want to set up NUnit Mock object for passing as a paramter and then check the result of MethodA in my unittest. How do I mock this IGrouping? ...

In which namespace the range attribute belongs to in NUnit2.4.8

In which namespace the range attribute belongs to in NUnit2.4.8 ...

Try catch in assert statement

I am doing regression testing using NUnit, WatiN and VB.net. What i am doing is opening an IE page, seleting some data, making a registration and then on view registration page testing the registration by assertion. I want to ask is it a good way to use try and catch on every assert. i am using it because if some assert fails it will st...

Nunit results

I am using Nunit results for managerial view of all the tests. After reading nunit doc it says it automatically update the results xml file after running the tests. But In my case it keep showing me the old results in index file where as updated reults in actual file. Any idea how can I update the index file according to the latest resul...

running nunit summary after completion of NUnit tests in a batch file

I want to to run nunit summary.exe after successful completion of NUnit Tests assembly. I am calling nunit from a batch file and then I want to call nunit summary. Any idea how to do this ...