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

How can I change the working directory for NUnit tests in Team City?

I am using Team City as the build server, and I have a msbuild build script to build and run integration tests for my project. However, Team City when running my tests decides to ignore the WorkingDirectory attribute on the NUnit task, and as a…
Grzenio
  • 35,875
  • 47
  • 158
  • 240
4
votes
1 answer

Error trying to run nunit tests with TypeMock in LINQPad

I love LINQPad and use it daily. I have been trying to find a way to create and run ad-hoc tests with nunit and TypeMock in LINQPad for a while. So I stumbled around and got some results, but some links are still missing. Here's what I have…
Helios
  • 61
  • 4
4
votes
2 answers

NUnit API And Running Tests Programmatically

This is the first time I'm trying to hack into the NUnit interface, and am facing some issues. This is what I am trying to achieve: Take a set of string inputs as code files and compile them into an assembly take the in-memory assembly and pass it…
Roopesh Shenoy
  • 3,389
  • 1
  • 33
  • 50
4
votes
4 answers

Private Accessor don't build when using MSBuild

My build server uses MSBuild to build my application. Our unit tests require access to some private members for testing, so we use the built in private accessors. Visual Studio has no problem with it, but when we push our code to the build server…
Odd
  • 4,737
  • 6
  • 30
  • 27
4
votes
3 answers

How to UnitTest WCF .SVC files

I am planning to unit test WCF Services that are exposed as .svc files. What are the best practices available to unit test them. As for as i know this is the option available: Create a seperate project and have proxy classes created for the .svc…
Alagesan Palani
  • 1,984
  • 4
  • 28
  • 53
4
votes
2 answers

How to tell nunit-console to use 4.0 under Mono?

I set up a simple project under MonoDevelop, and can run the tests successfully (*) from there. When I try nunit-console.exe from the commandline I get this: .../mono2/bin/Debug$ nunit-console mono2.exe NUnit version 2.5.10.0 ... Runtime…
Darren Cook
  • 27,837
  • 13
  • 117
  • 217
4
votes
2 answers

How do I make nunit-console look in \bin\Debug\ rather than \bin\x86\Debug for assemblies?

I am trying to set up a build machine and want to run nunit (on several relatively big and dynamic solutions) from a batch script. I ran the following command lines "C:\Program Files (x86)\NUnit 2.6.1\bin\nunit-console-x86.exe"…
André C. Andersen
  • 8,955
  • 3
  • 53
  • 79
4
votes
2 answers

Really basic moq example fails

I am trying out Moq, and I've gotten stuck in a very basic example. I want to mock a very simple interface IInput: namespace Example { public interface IInput { int SomeProperty { get; set; } } } This seems like a very easy…
Morten
  • 3,778
  • 2
  • 25
  • 45
4
votes
2 answers

Adding NUnit 2.6.1 reference Visual Studio 2012

I'm using Visual Studio 2012, and I've downloaded NUnit 2.6.1 to run Unit Tests on the code. I've added the reference to nunit.framework in the project of the solution where I'll be needing it. The problem is, for some reason when I try to include…
4
votes
2 answers

Nunit - testing exe

I have a solution in visual studio with 2 projects. A normal one and a 'test' project for NUnit tests. I have a reference in the testing project to the normal project. I tried adding tests and running them with the NUnit GUI, but I get an error…
will
  • 1,397
  • 5
  • 23
  • 44
4
votes
2 answers

Coypu screenshot

On the end of a Scenario, I want to take a picture if it has failed. The following code does not work: [AfterScenario] public void AfterScenario() { if(ScenarioContext.Current.TestError != null) { …
Michael
  • 363
  • 5
  • 20
4
votes
2 answers

Referencing Main Project from a separate NUnit Test Library

I'm brand new to Unit Testing, fresh out of college, and suddenly responsible for developing and maintaining a fairly large application by myself. The previous developer (who just left the company) included NUnit with the project references, wrote a…
KChaloux
  • 3,918
  • 6
  • 37
  • 52
4
votes
3 answers

nUnit tests looking for {assembly-name}.dll.config

I have a PowerShell script that shells-out to nunit-console-x86.exe to run tests in assemblies ( DLLs ) that were built earlier in the script by shelling to MSBuild to compile a VS .sln Exec { invoke-expression…
BaltoStar
  • 8,165
  • 17
  • 59
  • 91
4
votes
3 answers

Problem with runnig NUnit tests under STA

I have some NUnit test cases which need to be ran under STA model. As discussed in many web sites or blogs (for example here), I added a configuration file ("app.conig") to my NUnit test assembly with the following contents.
Kei
  • 1,596
  • 1
  • 16
  • 25
4
votes
1 answer

Unable to run NUnit test

I installed NUnit 2.6.1 and trying to run a simple test on Windows 7 x64. It causes an exception An attempt was made to load a program with an incorrect format. You may be attempting to load an assembly built with a later version of the CLR…
Alexandre
  • 13,030
  • 35
  • 114
  • 173