Test Driven Development involves writing a failing automated test to specify what is to be built. The test is then made to pass by writing code which satisfies the tested condition. Finally, the code is refactored.

learn more… | top users | synonyms

3
votes
2answers
79 views

Correct way to cover dependencies in unit tests

My approach to unit testing feels very wrong. I feel like I am missing something very basic, and I'm looking for some insight please. Let's assume that I am testing a method (I'm using NUnit) that ...
5
votes
3answers
83 views

Cautious File Writer

I'm trying to follow the path of Sandi Metz and others who state that aiming for small and simple is good for writing understandable code. I've written a method that takes care of writing content to a ...
5
votes
2answers
243 views

Gift aid calculator task

I have recently taken a small technical test in C# and the following were expected: All stories to be completed with an appropriate level of testing. No actual database implementation is required, ...
3
votes
2answers
173 views

Read Lines From IIS Log

The purpose of this class is to read an IIS log (or multiple ones). One thing to note is that the columns can differ based on settings in IIS. So a couple of concerns that I have: Is The ILogReader ...
13
votes
3answers
2k views

Interview task - SOLID Principle and TDD

I had a small technical C# task using SOLID principle and TDD. But I failed to prove my coding skill through the test. Can anyone offer any small advice for me? I am really eager to learn what my ...
7
votes
2answers
204 views

Am I implementing BDD correctly?

I'm writing a utility that validates fields on a web site. I decided I'd give Behaviour Driven Development (BDD) a try. The validator utilises rules to determine if a value the user provided is valid. ...
3
votes
4answers
308 views

How to (really) unit test an adapter?

My question is really simple: shall an adapter (design pattern) class be unit tested, and how? Example: I want to create a class ClientSocket with PHP, which is ...
4
votes
1answer
135 views

Simple class to represent progress

Progress class was written using TDD. Interface of this class (pseudo-code): ...
2
votes
1answer
70 views

Using RSpec subject to setup a test

I find myself using subject blocks in my tests to setup example because it is succinct. However is this considered bad form and can it have undesired consequences? ...
0
votes
1answer
352 views

How to write simple code using TDD

Me and my colleagues do a small TDD-Kata practice everyday for 30 minutes. For reference this is the link for the excercise http://osherove.com/tdd-kata-1/ The objective is to write better code ...
2
votes
1answer
72 views

A C# class to check if one JSON tree (de-serialised as ExpandoObject / Array etc) contains another

I wrote this partly as a learning exercise in TDD. Could I please have feedback on both how to improve the quality of the code and the completeness of the tests? I used LinqPad as my IDE for this, ...
2
votes
1answer
115 views

General thoughts on the style of this rspec-rails test

Here's a test from a Rails app I'm working on. I want to know if I'm using describe, let, ...
1
vote
1answer
140 views
1
vote
2answers
136 views

TDD Approach and Simple Solution

How many tests could you write for the enum class below. I am looking for the following output given the following command: ...
5
votes
3answers
807 views

Maximum Sub-array Problem

I started taking a look at a programming challenge I had read about earlier today on 8thlight. Unfortunately, it seems to have been taken down and all I could remember about it was the problem posed: ...
3
votes
3answers
131 views

Test Driving Interface Design [closed]

I have been doing TDD since I have started my first job out of university (about 5 months ago), most of which is working with legacy code. I started a personal project today and thought I would TDD ...