nunit

NUNIT is ignoring my tests? Why?

I Have a really simple test class as below. For some reason my test is being ignored by the GUI and coming up yellow. I have updated the framework and runner to 2.4.8 as I thought it might have been differences between versions being the problem. using System; using NUnit.Framework; namespace TestRunner { [TestFixture] class ...

Watin test hang application while uploading file

I have an issue with watin test that should browse for pdf and upload it to a web page. This test runs smoothly on my machine, always find pdf, click submit and wait 30 sec for upload completed. But when I try to run this test on build machine (teamcity), happens that test hang at the point when it should wait for upload. The problem...

Unit Tests for external projects

Hi, I'm trying to get a concensus of what people do with regard to unit tests and sub (or external) projects. I'll, hopefully, clarify with an example. I have a project P1 that relies on another project P2. P2 has its own unit tests and release cycle. P1 has its own unit tests as well. The question is should the unit tests for P2 be...

How do you get a #if conditional to work when unit testing?

this is what I would like to be able to do. /// <summary> /// Gets the session factory. /// </summary> /// <value>The session factory.</value> public ISessionFactory SessionFactory { get { if (_sessionFactory == null) { #if(NUNIT) ...

Same random number generated when run in test Fixture setup

I am trying to generate a random number during testing using NUnit, but it keeps generating the same number. I am using the following function for this purpose. dim dCount As Integer = Math.Floor((High - Low + 1) * Rnd() + Low) dim divName As String = "abc" & dCount Any idea why it is doing this? Regards, Sam ...

NUnit - specifying a method to be called after every test

Does NUnit let me invoke a method after every test method? e.g. class SomeClass { [SomeNUnitAttribute] public void CalledAfterEveryTest() { } } I'm aware of [SetUp] and [TearDown], but that only works for the tests in the current class. I want something like [TearDown], except it runs after every unit test, whether its in...

"Getting started" questions for NUnit (or NUnitLite) and .NET CF

I have an existing VS 2005 Std .NET Compact Framework application that I want to do some major refactorings on. Currently there is no unit testing in place, but I want to add this before messing with the code. I have no practical experience with unit testing, even though I know the theory (just never got around actually implementing it; ...

NUnit testing the application, not the environment or database

I want to be better at using NUnit for testing the applications I write, but I often find that the unit tests I write have a direct link to the environment or underlying database on the development machine instead. Let me make an example. I'm writing a class which has the single responsibility of retriving a string, which has been stor...

subversion/cruise control/nant/nunit with visual studio projects and solutions.

I work in a team of 2 developers and currently we use VSS and have no continuous integration or daily build and few Unit tests. I'm looking to change our source control to Subversion and at the same time get up and running with a more professional process. Subversion/cruise control/nant/nunit appears quite a popular combination from wh...

Understanding unit test constraints and NUnit syntax helpers

Me and a colleague are starting a new project and attempting to take full advantage of TDD. We're still figuring out all the concepts around unit testing and are thus far basing them primarily on other examples. My colleague recently brought into question the point of the NUnit syntax helpers and I'm struggling to explain their benefit...

Writing an addin for NUnit integration in VS 2005 IDE

I'm starting to write an add-in for Visual Studio 2005 that would integrate NUnit with the IDE. Any ideas on how and where I should start? I have a basic idea on how add-ins work. I believe I would need to know the NUnit API for this type of integration. Where can I find enough resources to achieve this? ...

NUnit on Mono?

Does anyone know if you can run NUnit on Mono? The reason I ask is because on the download page it says: For some releases, we provide a zipped package for use under Mono. However, the only release that actually has a separate mono release (judging by its label that says "mono:" and then shows the .zip) is the ancient 2.2. NUnit's...

NUnit doesn't find tests in assembly

Hi, I inherited an assembly with MSTest, but these tests were run using nunit-console on the build machine (not sure how it worked). So I decided to sort it out and change them to proper NUnit tests, but now nunit-console (or gui) can't find any tests. They run just fine using ReSharper test runner though. Any idea what could be missing...

Running C++ code through NUnit

Hello, I have tried to use NUnit to test C# code the is already connected to C++ code (without the NUnit the application work perfectly). In my test I run the main function through AppDomain.CurrentDomain.ExecuteAssembly(..), However when the C# code tries to "communicate" with the C++ it throws an exception and the test crashes. The ex...

Unit Testing code that doesn't execute immediately

Hi, I am using C# 3.0 and NUnit. I'm wondering if there is a standard way to perform unit tests on code that executes after some amount of time. For example, I have a simple static class that I can register methods with, and have them be called n milliseconds later. I need to assure that code in the delegate methods is being called. Fo...

How do I configure my settings file to work with unit tests?

I have a library I'm writing unit tests for. The library is used by two applications: one a Windows service, the other a command-line application that does some registry read-writes. Each has a slightly different App.config file that is loaded from the library at start-up. For example: public RetentionService() { Setting...

what is the best location for me to put nunit tests for a library which must be used from both ASP.Net and WinForms

I have an infrastructure library which must be used from both WinForms and ASP.Net. I would like to wrap this up in some unit tests. Which project do I put these in? Do I use another folder in my library project? A different solution which contains only my infrastructure project and a separate unit testing project? Incidentally, I wi...

How do I unit test private functions from a separate project in VB .NET?

As I develop code, I often want to unit test some of the building blocks of a class even if they are normally private. If my unit tests are inside the project, I can use "Friend" to accomplish this and still keep the functions private for normal use. But I would rather move my NUnit tests into their own separate project(s). How do I achi...

Standard Output from MSTest, NUnit, MbUnit, xUnit.NET test runners

How do you in any of the common .NET testing frameworks MSTest, NUnit, MbUnit, or xUnit.NET get the command line test runner to output a simple yes/no or true/false or 1/0 on whether all the tests passed or failed? I'm open to workarounds like: 1) no output if all the tests passed, output if anything fails. 2) count of tests that fail...

What are the advantages of the Constraint Model over the Classic Model in NUnit?

Besides better readability (maybe?) and being able to chain constraints using & and |, what other advantages does the Constraint Model have over the Classic Model? I'm a happy user of the Classic Model so deciding whether it's worth the effort to refactor old tests. Thanks. ...