tdd

ASP.NET How to best create a test DB when doing TDD?

Hi folks, what's the best practice for creating test persistence layers when doing an ASP.NET site (eg. ASP.NET MVC site)? Many examples I've seen use Moq (or another mocking framework) in the unit test project, but I want to, like .. moq out my persistence layer so that my website shows data and stuff, but it's not coming from a datab...

Does C1 code coverage analysis exist for Ruby?

I'm currently using Rcov to get C0 code coverage analysis for a rails project that I'm working on. However, those results are practically meaningless- I have 100% coverage according to rcov (as it only covers C0 analysis) and I've barely written half the test cases for the functionality that exists thus far. I'm used to the useful resu...

What is more important, testability of code, or adherence to OOP principles?

My teams evolution of TDD includes what appear to be departures from traditional oop. Moving away from classes that are self sufficient We still encapsulate data where appropriate. But in order to mock any helper classes, we usually create some way to externally set them via constructor or mutator. We don't use private methods, ever. ...

Should I start using TDD on a project that doesn't use it already

I have a project that I have been working on for a while, just one of those little pet projects that I would like to one day release to open source. Now I started the project about 12 months ago but I was only working on it lightly, I have just started to concentrate a lot more of my time on it(almost every night). Because it is a f...

How do you stub out User.Identity.Name in ASP.NET MVC?

I'm trying to unit test a page in my ASP.NET MVC application that, when posted to, will delete a user's item. I want to restrict this page so that it can only be posted to by the owner of said item. Originally, I wanted to just stick a quick check in the controller that checked if the HttpContext.Current.User.Identity.Name is equal to ...

Visual C++ TDD setup

I haven't worked much with Visual Studio before. I've started a personal project in my spare time and I would like to use test-driven development since it has been a huge benefit to me in my Java development. I started this project quite a while ago, and I used CppUnit. I know there are probably other frameworks that are better, but this...

Looking for a better JavaScript unit test tool

Let's consider the state of JavaScript unit tests and testing tools. JsUnit We already use it for some of our js code. Pros can be invoked from an ant build file launches browser to run the tests Eclipse plug-in Cons launches browser to run the tests Does not support js file to write the unit test code: it has to be embedded inside...

Unit Testing SiteMapNode

Does anyone know how to unit test SiteMapNode? We’re building some custom navigation controls, which renders unordered html lists from Site Maps with custom attributes. I’m trying to follow a test first approach but am finding that SiteMapNode has internal dependencies on HttpContext. To traverse the site map file it insists on using a ...

Why didn't unit testing work out for your project?

Give short concrete answer: why unit testing did NOT work out for you (your project). Will you particularly try again on a different project? ...

Developers are dissatisfied with TDD. Is TDD really the problem, or is it a lack of skill of novice practicitioners?

(This is a not a question to survey the merits of TDD. There are other places for such discussions. Thanks in advance.) I've been experiencing too many developers who are novice at the technique, who are also reporting dissatisfaction with, test driven development and NUnit. I hear negative comments like: "I don't like NUnit. I t...

Data access Integration Testing ... how do you do it ?

public class RollBack : OnMethodBoundaryAspect // or another AOP for meth interception { public override void OnEntry(MethodExecutionEventArgs eventArgs) { try { ServiceConfig cfg = new ServiceConfig(); cfg.Transaction = TransactionOption.RequiresNew; cfg.TrackingAppName = "Appl...

TDD with Episerver

What is the best way to abstract the episerver infrastructure for easier testing? ...

Outsourcing Classes by Supporting Unit Tests

I've got an application which developed by employing TDD as methodology (not strictly but mostly). Now I want to outsource some parts of the application because I don't have enough time to develop it. I'm planning use websites such as "Rent A Coder", "elancer" etc. I don't want to give out my code to anyone else, so I'm planning to giv...

How to design code for testability

I have been looking at using TDD and implementing proper testing (only just started to learn how much better it makes your life) in any of my projects that I create in the future. So for the last couple of days I have been floating around on SO trying to learn about how to design your application for testability, but I still seem to be ...

TDD and ADO.NET Entity Framework

I've been playing with ADO.NET Entity Framework lately, and I find that it suits my needs for a project I'm developing. I also find cool its non-invasive nature. After generating a data model from an existing database you are faced with the task of integrating the generated model and your business logic. More specifically, I'm used to i...

How to shift your paradigm to Test Driven Development...

I've had been hearing about test driven development for a couple years now and I never really paid too much attention to it from a practical level until recently when I started getting more interested in the .Net MVC. I've been playing around a lot with the MVC Storefront Sample and I am realizing just how cool and helpful that Test Driv...

How do I test database-related code with NUnit?

I want to write unit tests with NUnit that hit the database. I'd like to have the database in a consistent state for each test. I thought transactions would allow me to "undo" each test so I searched around and found several articles from 2004-05 on the topic: http://weblogs.asp.net/rosherove/archive/2004/07/12/180189.aspx http://weblo...

Unit Testing: Creating a 'mock' request to simulate a MVC page request

Hi, How do I go about creating a mock request for my asp.net-mvc application for unit-testing? What options do I have? I am using FormsCollection in my Actions so I can simulate form input data also. ...

actionscript tdd frameworks

Any list of Testing frameworks for ActionScript 2.0/3.0 around there? ...

How do I do TDD efficiently with NHibernate?

It seams to me as most people write their tests against in-memory, in-process databases (like SQLite) when working with NHibernate, which is fine. I have this up and running but my first test (that uses NHibernate) always takes between 3-4 seconds to execute, next test runs much faster. I am using FluentNhibernate to do the mapping but ...