tdd

Tips on how to write refactoring-friendly unit TDD tests

Hi, I've been working on an ASP.NET MVC project for about 8 months now. For the most part I've been using TDD, some aspects were covered by unit tests only after I had written the actual code. In total the project pretty has good test coverage. I'm quite pleased with the results so far. Refactoring really is much easier and my tests h...

TDD and testing before or after writing source code?

I have seen many articles on why Test Driven Development is good and that it reduces development time and so on. But after searching through a lot of forums, I am still yet to get a concrete advantage of TDD. I am not saying testing is a bad thing, but my point is what is the harm if I write my unit test after I write my source code rath...

Best practices for multiple asserts on same result in C#

What do you think is cleanest way of doing multiple asserts on a result? In the past I've put them all the same test but this is starting to feel a little dirty, I've just been playing with another idea using setup. [TestFixture] public class GridControllerTests { protected readonly string RequestedViewId = "A1"; protected Grid...

TDD - beginner problems and stumbling blocks

While I've written unit tests for most of the code I've done, I only recently got my hands on a copy of TDD by example by Kent Beck. I have always regretted certain design decisions I made since they prevented the application from being 'testable'. I read through the book and while some of it looks alien, I felt that I could manage it an...

TDD - top level function has too many mocks. Should I even bother testing it?

Hello, I have a .NET application with a web front-end, WCF windows service back-end. The application is fairly simple - it takes some user input, sending it to the service. The service does this - takes the input (excel spreadsheet), extracts the data items, checks SQL db to make sure the items are not already existing - if they do not ...

Best automatic test framework for octave

Which is the best framework for automatic testing in octave? Why? ...

Which open-source C++ projects have good (inspiring) tests?

What are inspiring examples of open-source software written in C++ with great tests? I would like to read, study and follow. ...

Creating a Mapping Function Through TDD: Too Much Time Spent Writing Tests?

I'm a big TDD enthusiast, and always strive to write tests before writing production code to ensure correct behavior of the code that I'm writing. Occasionally, however, several question if it is prudent to write a large body of tests for certain kinds of methods. This seems to come up most often when writing a mapper class. public clas...

Moq and Command Pattern .I am struggling can you help?

Hi all, New to the world of TDD and I have soon find out that mocking at times is not as easy. We are using MOQ at work so I need to learn how to do this using moq I have some code using the command pattern and works a treat.However If were to test drive it I would not know how to do it implementing the code below. I have done the foll...

Where and how can I learn software testing techniques?

I want to learn how to build “robust” software that is designed to test itself. In other words, how do I implement automated tests in my software ( using java or groovy or c++ ). So I want to know where to learn this (books or websites) and which tools and libraries I will need for this? ...

Is CI worth implementing for a one or two man project?

Hello, At work where we do LOB .NET/MSSQL developement, many projects we have are 2 person or even 1 person projects that have development life cycles of 1-3 months. The developers serve as business analyst/project managers/QA so things get done fast with minimal 'BS time' spent. We do get the bigger projects that can take 6 months and ...

Best practices for TDD and reporting

I am trying to become more familiar with test driven approaches. One drawback for me is that a major part of my code is generated context for reporting (PDF documents, chart images). There is always a complex designer involved and there is no easy test of correctness. No chance to test just fragments! Do you know TDD practices for this ...

Embedding Tomcat and issuing requests to the deployed application

OK, I'm completely stuck. I want to run Tomcat in embedded mode so I can test an application without running the server in a separate process. I'm missing something simple, stupid, and important, and I need your help to see it. This test fails with an HTTP error 400, Bad Request. I've tried MemoryProtocolHandler, context.invoke(), ... I...

Testing a interface repository.

I was wondering what I should test and how I should test an IRepository. At the moment I created a MemoryRepository in my domain and I am testing that with fake data. I am not sure if this is correct though. Feels a little weird to first create some data and then test to see if the repository returns it correctly. This is what my Memo...

How can I mock Server.HtmlEncode

I am trying the following, but I am getting : Object reference not set to an instance of an object. HttpContextBase mockContext = MockRepository.GenerateMock<HttpContextBase>(); mockContext.Expect(c => c.Server.HtmlEncode("")).IgnoreArguments().Return(""); mockContext.Expect(c => c.Server.HtmlDecode("")).Return(""); controller.Con...

Should I unit test XML schema?

I am in the very early stages of writing XML schema for my work's enterprise application. The XML to be validated represents an application - similar to Winforms - forms, grids, menus etc but without layout. The prime purpose of the XSD is not so much to validate the XML but to add design-time discoverability to the XML file, so that on...

How do you solve the infinite regress problem in TDD?

If I write test code to test my code, the test code might have bugs so it needs to be tested and when my code changes my test code may have to change. Repeat ad infinitum. How is this problem solved (in practice and in theory)? ...

Cuke4Nuke or SpecFlow?

I am trying to decide if I should use Cuke4Nuke or SpecFlow. What are the pro/cons of each? Opinions on which is better and why. Thanks! ...

Testing an MVC Controller action with an ActionFilterAttribute

A well-known benefit of MVC is its suitablility for Test Driven Development (TDD) because you can directly call your controller actions from your test methods. How can you test the combination of a controller action with a ActionFilter attribute (using OnActionExecuted to modify the ActionResult returned by the Action)? If I just call ...

Implicit typing and TDD

I just read this post and it makes the case against implicit typing using when starting out with Test driven development/design. His post says that TDD can be "slowed down" when using implicit typing for the return type when unit testing a method. Also, he seems to want the return type specified by the test in order to drive development...