nunit

[NUnit+Moq] Guidelines for using Assert versus Verify

I'm new to unit testing, and I'm learning how to use NUnit and Moq. NUnit provides Assert syntax for testing conditions in my unit tests, while Moq provides some Verify functions. To some extent these seem to provide the same functionality. How do I know when it's more appropriate to use Assert or Verify? Maybe Assert is better for con...

Is there a free code coverage tool suitable for use with .NET 4 and NUnit?

Is there a free code coverage tool suitable for use with .NET 4 and NUnit that runs from the command line (and is thus suitable for use on a build server)? Please note that any tools that require editions of Visual Studio higher than Professional are not appropriate in this case. I am asking this question because I can't get NCover 1.5...

Which unit test framework in VS2010 - MSTest or NUnit?

Possible Duplicates: Ms Test or NUnit? NUnit vs Visual Studio 2008s Test Projects for Unit Testing? what test data approach/framework is recommended for .net unit testing Are there real differences between NUnit and Microsofts Unit Testing Framework (VS 2008)? Any recommendations re whether to got MSTest or NUnit for a ...

what test data approach/framework is recommended for .net unit testing

Hi, what test data approach/framework is recommended for .net unit testing? I'm in VS2010, C#, doing business logic layer testing. By approaches I mean like: creating database snapshots, programmatically creating each time, etc etc. Like what approach to use to ensure at the start of each test the database is in a known state. ...

Zero division does not throw exception in nunit

Running the following C# code through NUnit yields Test.ControllerTest.TestSanity: Expected: `<System.DivideByZeroException>` But was: null So either no DivideByZeroException is thrown, or NUnit does not catch it. Similar to this question, but the answers he got, do not seem to work for me. This is using NUnit 2.5.5.10112, and .NET ...

Learn to use Unit testing and Nunit application

Hi All I need to start using unit tests in my code . The problem is that i never written unit tests . Can you please recommend me some good sites and book how to write correctly unit tests and to use nunit application . Thanks a lot for help. ...

Forcing loading of Asp.net development server with DEBUG for testing wcf service (nunit)?

can anyone help? I have a solution in vs 2010 which contains a WCF Service application and a class library which has a number of Nunit test. The nunit tests the service. Problem is that there is no Asp.net Development server running - is it possible to force it to run under debug mode.. I can press F5 but then i can't run my tests. M...

Testing UI with MsTest

With NUnit, I could use NUnitForms to test the UI. It's massively cumbersome, but it gets the job done. Is there something similar for MsTest for the version shipping in VS2008? ...

C#: Use NUnit to test classes that use Nhibernate

I have a project with a lot of classes that use Nhibernate. Now I want to use NUnit to test those classes. Are there specific things I need to consider? ...

App.config for SpecFlow not recognized by NUnit GUI runner

How do I get my App.config file to be recognized/used by the NUnit GUI runner? I have tried placing it in the top folder of my project and in the same folder as my feature files. Here are the contents of my App.config file: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="specFlow" type="Tech...

NUnit test under mono

I have a mut.cs as follows. using System; namespace ns { public class Arith { public int Add(int x, int y) { return x + y; } public int Mul(int x, int y) { return x * y; } } } I came up with a Unit test for this - mut_test.cs using NUnit.Framework; using System; using...

Execute TestSetup only some of the time?

Within one fixture is it possible to markup tests in such a way that the test-setup is only called for some tests and not for others? [Test] public void TestWithoutSetup() { .. } [Test] public void TestWithSetup() { .. } What would I need to do make the above work? ...

Run NUnit 2.5.5 tests in Gallio 3.1

Hi, I'm trying to get Gallio running some existing NUnit tests but they're not showing in Gallio. The assembly loads into Gallio fine and I can run them fine via Resharper within the VS IDE. I created a really simple NUnit test in VS and this also doesn't show so I know it's not something weird in my existing tests. Any ideas? ...

NUnit integration programmatically with spring

Hi! I have a component based architecture framework designed and I use NUnit for isolated testing - okay so far. Now I want to enable integration tests. Therefore the tests use real implementations of the existing components. Each element of the component has a life cycle (init, start and stop) and I created a NUnit component. In the ...

NUnit SetUpFixture attribute equivalent in xUnit?

In nUnit, SetUpFixture allowed me to run some code before any tests. Is there anything like that when using xUnit? From nUnit documentation: This is the attribute that marks a class that contains the one-time setup or teardown methods for all the test fixtures under a given namespace. ...

FileNotFound Exception when using TestDriven.NET and NUnit

I'm Writing a simple pong game in C# and XNA 4.0 to learn unit testing. The tools used are TestDriven.NET and NUnit, all newest versions. The problem is, if I test the code with VS2010 internal debugger, everything runs fine, but when I use "Run Test(s)" from menu, the application chokes with error: Test 'WindowsGame1.Game1.TestGameMenu...

How to set a breakpoint in a Nunit test and step through with Visual WebDeveloper 2008?

I have written a NUnit test in Visual Web Developer 2008 Express. But when I run the test, it doesn't pause at the breakpoint I had set. It just keeps on running but at the breakpoint, I need a step-by-step view on the test. Could anyone please tell me how I can use breakpoints with NUnit? Thanks in advance! ...

Use external datasource with NUnit's TestCaseAttribute

Is it possible to get the values for a TestCaseAttribute from an external data source such as an Excel Spreadsheet, CSV file or Database? i.e. Have a .csv file with 1 row of data per test case and pass that data to NUnit one at a time. Here's the specific situation that I'd like to use this for. I'm currently merging some features from ...

Can I have code that executes before and after tests are run by NUnit?

I've got a bunch of tests in NUnit which create garbage data on the filesystem (bad, I know, but I have little control over this). Currently we have a cleanup tool that removes these temporaries and such, but I'd like to be able to run that cleanup tool automatically. I'd have to be able to run it after all tests have finished running. I...

How to convert NUnit output into an HTML report

Does anyone have any suggestions for a good tool, xslt or other that can produce an HTML report from the XML output of NUnit? We're currently using NUnit 2.5.5 to run a number of tests on our code base. The dev team are happy seeing the output in the GUI and console runners and the report shown on our Hudson server. The Hudson generate...