nunit

What OSS software should I use for enterprise software?

Summary: OSS Technologies that fit with MS C#, Dot Net, and VS enterprise development. I am not trying to be subjective. I need a finite list of MS C# specific enterprise practices with matching OSS software titles that work with MS MVC (outlined below). From there I can review and setup a "hobbie kit" installer for my dev team. I wa...

How do I log which tests failed and which tests succeeded with NUnit by logging the test name?

How do I log which tests failed and which tests succeeded with NUnit? I want to be able to write all of the NUnit output to a file after all of the tests run. ...

How do you know on NUnit TearDown if a test threw an exception and what that exception was?

I have an bunch of NUnit tests that all inherit from a class that implements the NUnit Teardown function. [TearDown] public void TeardownTest() { } Whenever one of the tests generate an exception it just jumps straight to the TearDown function. How do I know what the exception was that was generated that caused it to go to that...

What is the Best Test Automation Approach for WatiN

I Studied both data-driven and keyword driven approaches. After reading, It seems data driven is better than keyword. For documentation purpose keyword sounds great. But it has many levels. I need guidance from people who actually have implemented Automation frameworks. Personally, I want to store all data in database or excel and break ...

All my tests are ignored in Nunit

I have written a HomePageClass Imports System Imports System.Collections.Generic Imports System.Text.RegularExpressions Imports System.Text Imports WatiN.Core Namespace TestDesign Public Class HomePage Inherits IE Public Const HomePageURL As String = "test" Public Sub New() MyBase.New(HomePageU...

How can I have a dynamic URL in generic class

I need to have a dynamic URL preferably from a Test Class. Can any one help me in formatting this design pattern to handle dynamic links from tests. instead of a constant HomePageURL. Namespace TestDesign Public Class HomePage Inherits IE Public Const HomePageURL As String = "testlink" Public Sub New() MyBase.New(H...

How can I Unit-test the behaviour of the HandleError attribute for a controller method?

I'm trying to verify the behaviour of my ASP.Net MVC app when an unexpected error occurs. Specifically, I'm trying to verify that the user is directed to the error page I've defined for my app. The problem I'm encountering is that I'm not able to verify the behaviour of the controller method as expected. For my normal behaviour tests, I...

WatiN generates empty pages

Hi! When capturing images using WatiN the resulting images are just empty, solid black. The size of the images equals the screen size, though. For example the following snippet just saves two black images. using (IE ie = new IE()) { ie.ClearCache(); ie.BringToFront(); ie.GoTo("http://localhost/"); ...

Database for Importing NUnit results?

I have a large set of NUnit tests; I need to import the results from a given run into a database, then characterize the set of results and present them to the users (email for test failures, web presentation for examining results). I need to be tracking multiple runs over time, as well (for reporting failure rates over time, etc.). The...

Whats the difference between these two strings?

Using nUnit to test the output (currency formatting) for a specific culture but we are getting the following result. Fail: Formatting currency amount String lengths are both 11. Strings differ at index 2. Expected: "12 765,87 €" But was: "12 765,87 €" -------------^ We can't see the difference between the strings. Our expec...

asp.net MVC Unit Tests with NUnit

Hi, I've been trying to learn asp.net mvc using the videos posted on the asp.net website and I'm running into a problem doing unit testing. I have a very simple controller that uses Linq to SQL to get an array of objects: public ActionResult Index() { ViewData["Message"] = "Welcome to ASP.NET MVC!"; using (Tra...

C# Assert.AreNotEqual versus Equals

While trying to verify to myself, that C# Equals for IEnumerables is a reference equals, I found something odd. With the following setup in NUnit var a = (IEnumerable<string>)(new[] { "one", "two" }); var b = (IEnumerable<string>)(new[] { "one", "two" }); this test Assert.IsFalse(a.Equals(b)); passes, while this test Assert.AreNot...

How do you stub IQueryable<T>.Where(Func<T, bool>) with Rhino Mocks?

In the .net 3.5 project that I am working on right now, I was writing some tests for a service class. public class ServiceClass : IServiceClass { private readonly IRepository _repository; public ServiceClass(IRepository repository) { _repository = repository; } #region IServiceClass Members pu...

How to find path of active app.config file?

I'm trying to finish this exception handler: if (ConfigurationManager.ConnectionStrings["ConnectionString"]==null) { string pathOfActiveConfigFile = ...? throw new ConfigurationErrorsException( "You either forgot to set the connection string, or " + "you're using a unit test framework that looks for "+ "the...

"Hello World" - The TDD way ?

Well I have been thinking about this for a while, ever since I was introduced to TDD. Which would be the best way to build a "Hello World" application ? which would print "Hello World" on the console - using Test Driven Development. What would my Tests look like ? and Around what classes ? Request: No "wikipedia-like" links to what T...

NUnit: Parametric test with generic methods

In NUnit 2.5 you can do this: [TestCase(1,5,7)] public void TestRowTest(int i, int j, int k) { Assert.AreEqual(13, i+j+k); } You can do Parametric test. But I wonder whether you can do this or not, Parametric test with generic test method?, i.e., [TestCase <int>("Message")] public void TestRowTestGeneric<T>(string msg) { Assert....

How-to create a simple example Console application for developing separate classes for test driven development?

Hi all! My intend is to create a simple easily debuggable console application which will be the template ( or starting point ) for test driven developing single classes in C#. The purpose is to have a simple folder where this console app will reside and just copy paste the folder open the new project and start writing the new class. As s...

How to make NUnit assertion failures show line numbers for C++?

When I run NUnit tests against my C++ code and an assertion fails, I don't get line numbers for where the failure occurs. Sample Method: [Test] void testMethod() { Assert::Fail("test comment"); } Sample output: [nunit2] Failures: [nunit2] 1) namespace.SomeTest.testMethod: test comment [nunit2] at namespace.SomeTe...

Generating tests from run-time analysis

We have a large body of legacy code, several portions of which are scheduled for refactoring or replacement. We wish to optimise parts that currently impact on the user-experience, facilitate reuse in a new product being planned, and hopefully improve maintainability too. We have quite good/comprehensive functional tests for an existing...

What is the best way to automate integration testing MSMQ with Visual Studio Test suite / NUnit?

I would like to create a series of automated unit tests for an MSMQ application I am writing. As I see it, the challenge is how to accommodate the event handlers from the test method. That is, I send a message from the test method and need to return a result back to that test method that the message has been received and handled. I ha...