tdd

What is Best for Defect Rate Tracking? Defects per KLOC?

I'm trying to create some internal metrics to demonstrate (determine?) how well TDD improves defect rates in code. Is there a better way than defects/KLOC? What about a language's 'functional density'? Any comments or suggestions would be helpful. Thanks - Jonathan ...

how to write tests without so many mocks?

I am a heavy advocate of proper Test Driven Design or Behavior Driven Design and I love writing tests. However, I keep coding myself into a corner where I need to use 3-5 mocks in a particular test case for a single class. No matter which way I start, top down or bottom up I end up with a design that requires at least three collaborators...

How to convince a client that all next projects/enhancements should be done via TDD (with some agile practices)?

We are a small team (3 developers) and one of our main clients is about to submit a bunch of new feature requests and a follow on project to us to get estimates on cost and delivery times. Our last project with them was a 'success' in that they are coming back to us but I know we could have done a much better job (we used waterfall... t...

Unit testing a class with no return value?

Hello, I didn't find much in tutorials on this specific question.. So I have a class called 'Job' which has public ctors and a single public Run() function. Everything in the class is private and encapsulated in the class. (You may remember an older post here on this http://stackoverflow.com/questions/1590953/testing-only-the-public-me...

Is there any framework for .NET to populate test data?

I am use c# and for unit testing and integration testing usually I need to populate fields automatically based on attributes. Lets say we will test if we can write and get back user data to database. I create a user object populate fields write user to database Read user object from database Check fields if what I write is same a...

Is behaviour driven development about design or analysis?

The more I read about BDD and how it is supposed to be improved TDD the more confusing it all seems to me. I've found quotes from expert that say it's about design, but also from other experts that say it's about analysis. The way I currently see it is this: 1) analysis: BDD from wikipedia The result of object-oriented analysis ...

Eat, Sleep and Breathe Unit Testing/TDD/BDD

I do write unit tests while writing APIs and core functionalities. But I want to be the cool fanboy who eats, sleeps and breathes TDD and BDD. What's the best way to get started with TDD/BDD the right way? Any books, resources, frameworks, best practices? My environment is Java backend with Grails frontend, integrated with several exter...

Unit Testing a large method

Following Test-Driven Development that is. I've recently implemented a algorithm (A*) that required a clean interface. By clean all I want is a couple of properties and a single search method. What I've found hard is testing the search method. It contains around five steps but I'm essentially forced to code this method in one big go ...

Does NUnit's Is.EqualTo not work reliably for classes derived from generic classes?

Today I ran into the following problem with NUnit. I have a class, that derives from a generic class. I started to do some serialization tests and tested for equality using the Is.EqualTo() function of NUnit. I started to suspect something is wrong, when a test that should have failed passed instead. When I used obj1.Equals(obj2) inste...

How can I test a Singleton class with DUnit?

Or it's better to use another Design Pattern? ...

What License should I use for a new OSS project in .NET

Greetings, Anyone who is big into TDD and who uses .NET seems to eventually run into the sealed classes problem. Some classes in the .NET library are sealed which prevents you from extending them (and thus mocking them). To add insult to injury Microsoft does not provide interfaces for these classes. Work of all the classes have a t...

Experiences with Test Driven Development (TDD) for logic (chip) design in Verilog or VHDL

I have looked on the web and the discussions/examples appear to be for traditional software development. Since Verilog and VHDL (used for chip design, e.g. FPGAs and ASICs) are similar to software development C and C++ it would appear to make sense. However they have some differences being fundamentally parallel and requiring hardware ...

Are there BDD/TDD tools for developing in VB.NET?

I am responsible for rewriting an internal tool for my company. I am currently reworking the most time consuming step to run faster which should give me time to re-think the design of the application for a full rewrite as the interstitial version will meet the current needs. I really want to take this opportunity to implement this code...

TDD, Mocking, dependency injection and the DRY principle

I've got a controller class which accpets multiple parameters in the ctor which gets injected at runtime. Example: public ProductController(IProductRepositort productRepository, IShippingService shippingService, IEmailProvider emailProvider) { ... } I am finding that the Test methods are getting huge. I am setting u...

Testing file based persistence

we have code that persists a file and I would like to check the content of the file during testing. I though that such scenario will be best implemented if I abstract the file persistence operation to the following interface: public interface IFilePersist { void Save(XXX, FileLocation); } In unit testing I will inject the mock that...

Moq - How to verify that a property value is set via the setter

Consider this class: public class Cotent { public virtual bool IsCheckedOut {get; private set;} public virtual void CheckOut() { IsCheckedOut = true; } public virtual void CheckIn() { //Do Nothing for now as demonstrating false positive test. } } The Checkin method is intentionally empty. Now i have ...

BDD both from business level

In my current project I want to use Behavior Driven Development (BDD), on both levels of business requirements application level tasks. Is it all right to wrap (group) my internal BDD specs into my high level specs so clients would see that business requirement is done (all internal specs in that requirement passed) but don't actually s...

TDD/BDD in particular for a Rails application

How granular should one get when using TDD/BDD methods for developing an application? In particular with regards to a Rails application. Would you test for every single field individually and then right the migration that will make it pass? So every field would have it's own migration? What would you actually test against to make sur...

Which objects to mock when doing TDD

When creating methods, should every object instantiated inside that method be passed in as a parameter so that those objects can be mocked in our unit tests? We have a lot of methods here at work that have no associated unit tests and upon writing tests retrospectively; we find that there are quite a lot of objects instantiated inside t...

When an operation needs to pass more than just the result, do you tuple/throw/or getContextual?

I’m trying to refactor some “sending out an email” code by dividing the steps (validate, attach related content, format, send) into separate classes that can be more easily tested, logged, and updated. As part of this I’ve got to figure out a way for the operations to communicate validation or transient errors (“that item was deleted”)...