Questions tagged [nunit]

NUnit is an open source unit testing framework for .NET and Silverlight written in C#. It serves the same purpose as JUnit or TestNG does in the Java world, and is one of many in the xUnit family.

Initially ported from JUnit, this xUnit based unit testing tool for was written entirely in and has been completely redesigned to take advantage of many .NET language features, for example custom attributes and other reflection related capabilities. NUnit brings xUnit to all .NET languages. The current production release, version 3, has been completely rewritten with many new features and support for a wide range of .NET platforms.

References

Tutorials

7425 questions
4
votes
1 answer

NUnit CPU usage very high - How to resolve?

On numerous unrelated, projects the CPU usage of NUnit has often ended up being about 50% even when I'm not running my tests. From other information I've read this is supposedly more to do with my code than Nunit. Does anyone know how I can isolate…
Castrohenge
  • 8,525
  • 5
  • 39
  • 66
4
votes
1 answer

Examples of a working ITestCaseProvider implementation for NUnit?

Does anyone have any working examples of an ITestCaseProvider? The samples I've come across, don't get picked up by the any test runnings - GUI, Console or Resharper (I've put the assembly in all the right places). I've added Debugger.Break to them…
Kieron
  • 26,748
  • 16
  • 78
  • 122
4
votes
2 answers

Nunit add a custom attribute

I have taken the code example from this link to implement a new Nunit attribute to 'Repeat a test when failing'. I have added this code as a class in my solution. I then call this new class along side the [Test] attribute: [Test,…
Benny Meade
  • 602
  • 10
  • 25
4
votes
3 answers

How would you apply unit testing in this situation?

I have never written unit tests before, for various reasons. I have a chance to write tests now, comfortably, because I have a small app to make from scratch. However, I'm a bit puzzled. The application is supposed to use a printer with a smart card…
Evgeny
  • 3,320
  • 7
  • 39
  • 50
4
votes
2 answers

Multiple Browsers Tests using Webinator+Selenium, SpecFlow and NUnit

I'm developing an ASP.NET MVC 3 app with WebinatorSpecFlow+NUnit using the Selenium driver. I'm having a problem running parallel tests with Chrome (using chromedriver) and Internet Explorer. Whenever I have both tests running in the same session…
Leonardo Eloy
  • 2,633
  • 2
  • 14
  • 13
4
votes
1 answer

NUnit TestFixtureSetUp runs multiple times?

I have a basic Test setup using NUnit 2.6 and Visual NUnit in Visual Studio 2010. My problem is that when I'm running all tests it seems like the FixtureSetup method (which has the TestFixtureSetUpAttribute) is running one time for each of the…
AndersLindas
  • 137
  • 1
  • 9
4
votes
1 answer

how to debug tests in .net

I want to debug my tests, to examine every test to see where exactly is fail. I was using coderush which is awesome tool but my trial period 1month is expired. Any suggestion is welcome.
panjo
  • 3,467
  • 11
  • 48
  • 82
4
votes
1 answer

ExpectPublish fails when Publish(params T[] messages) contains more than one message

I'm attempting to test the following publishing-code (classes and properties are adjusted for example-purposes): public void PublishMessages(List shareRegistrationResult) { var failedMessages = shareRegistrationResult …
Yngve B-Nilsen
  • 9,606
  • 2
  • 36
  • 50
4
votes
1 answer

How do I use ExpectedException in C++/CLI NUnit tests?

How do you do the equivalent of: [Test, ExpectedException( typeof(ArgumentOutOfRangeException) )] void Test_Something_That_Throws_Exception() { throw gcnew ArgumentOutOfRangeException("Some more detail"); } ...in C++ (the example there is C#)?…
Jon Cage
  • 36,366
  • 38
  • 137
  • 215
4
votes
2 answers

MissingMethodException on a property in NUnit test

I'm having problems with a test. For some reason, that I haven't figured out, I can't access a n object's public property. My class is the following: public class FakeSMTPConnector : ISMTPConnector { private bool _MailSent = false; public…
MytyMyky
  • 608
  • 7
  • 15
4
votes
1 answer

Re-run the failed Selenium Nunit tests

In our test environment, there are some tests that fail irregularly on certain circumstances. So my question is, what can be done to rerun the failed Nunit tests only. My idea is implement some steps in the Nunit TearDown to re-run the failed test…
anil
  • 117
  • 1
  • 1
  • 7
4
votes
1 answer

OpenRasta Mocking HttpContext in Unit Tests

Currently i am writing a unit tests for my handler methods using NUnit.I have used HttpContext.Current in one of my Controller Methods which throws NULL reference exception at HttpContext.Current when i execute test cases for my handler. Is there…
prashant
  • 2,181
  • 2
  • 22
  • 37
4
votes
4 answers

How can an IRepository be unit tested?

I have written the following method using the Repository mentioned in the following blog-post (http://www.codecapers.com/post/Using-RavenDB-with-ASPNET-MVC.aspx) using RavenDB: public User GetUserById(string id) { var user = (from usr in…
Alexander
  • 1,021
  • 6
  • 20
  • 38
4
votes
2 answers

Correct Hebrew character sequence in C# and searchable PDFs

I'm testing an SDK that extracts text from a searchable PDF. One of the SDK's dependencies was recently updated, and it's causing an existing test on Hebrew text to fail. I don't know Hebrew nor enough about how the involved technologies represent…
Sage Mitchell
  • 1,563
  • 8
  • 31
4
votes
2 answers

Debugging with NUnit

I'm using NUnit for my unit tests and I have my unit test class library project setup so that Visual Studio launches the NUnit gui when I press F5. This lets me set breakpoints in my tests and look at the contents of variables, etc. What isn't…
Joe
  • 447
  • 2
  • 8
  • 15
1 2 3
99
100