tdd

What is the best tool for Test driven Development using asp.net 2.0?

We are using Asp.Net 2.0 and planning to move to TDD so that middle tier can be developed and tested while others in the team take care of UI and DataBase area. Can anyone kindly let me know the pre-requisites for TDD and which one is the best tool for .net? Thanks... [UPDATE] Thanks everyone for your answers and help. I was readin...

File/Registry Test Case for NUnit

I am new (as of today) to NUnit and TDD. However, I am very interested in the technique and I am trying to learn. I have a test case I would like to read from a file if it exists, otherwise I will grab from the registry. How do I test both conditions? Here is an example of the code I would like to write a test case for: public s...

How to test drive a networking application with custom protocol?

I'm currently developing two Java networking applications for school projects. One over TCP and the other one over UDP. In both I have to implement simple custom protocol. Even though I'm trying pretty hard, I can't find a way how to correctly test this kind of apps, or better develop with test first development. If I have a client and...

How do I run a function before each test when using qUnit?

What is the equivalent of nUnits [SetUp] attribute for qUnit? ...

C#: How would you unit test GetHashCode?

Testing the Equals method is pretty much straight forward (as far as I know). But how on earth do you test the GetHashCode method? ...

Best practices for unit tests, mock objects, and ioc

Okay so I have been trying to get into IoC lately. However, I keep running into one hurdle - that is the fact that I love using mock objects. They are quick and painless to setup. However, if I use IoC all over the place in my code then it forces me to create test implementations (and configurations) of my objects instead of using moc...

TDD/BDD Rails Cucumber / RSpec duplication

Can someone please clarify using a SIMPLE user story the full slice of what Cucumber would be used for and what RSpec would be used for? I purchased the RSpec book the other day and have been going through it. The author seems to be quite vague at times. What I'm thinking of if the user story is something like (please excuse the synta...

Testing private method of an abstract class using Reflection

How can I test a private method of an abstract class using reflection (using C#)? I am specifically interested in adapting the code found in this thread. I am aware of the discussion around the principle of testing private codes in the first place (one should not in general !!). I have already decided to do that for my situation because...

Resources for TDD best practices, methods, etc

I'm looking for a good set of resources to get starting on converting to TDD, I always seem to start off with getting unit tests running at first but the more I develop the less I want to write tests for things that I know work. So I am looking to change my mindset and start developing with a TDD mindset ...

Testing things that should be the same both ways

For example the Equals method. a should equal b and b should equal a. Would you say it is OK to check this in one test case using two asserts like the following: [Test] public void Equals_TwoEqualObjects_ReturnsTrue() { var a = new Something(); var b = new Something(); Assert.That(a.Equals(b), Is.True); Assert.That(b.Eq...

Does TDD really stop gold plating?

Questions that I want answers for... 1) Propose one or more mechanism, which could be used to extend TDD to estimate the level of gold plating that exists in an arbitrary Java program. 2) What estimations would your mechanism provide the quantity the level of gold plating? 3) What evidence can you provide (if any) to justify or argue ...

How to decide which parts of code to review?

Esp. if there is a very large code base and if the team is also doing some level of test-driven development, it is not practical and also does not make sense to do review of entire code-base. In such a case, how do we decide which parts of code to review and whether it is effective at all? This question is also related to 527259. ...

When not to Use Integration Tests

I am writing an application that uses 3rd party libraries to instantiate and make some operations on virtualmachines. At first I was writing integration tests to every functionality of the application. But them I found that these tests were not really helping since my environment had to be at a determined state, which turned the tests m...

unit test a method that creates an object

I'm trying to get my head round Unit Testing and there's one more piece of the jigsaw I need to find. What I'm trying to do is write tests for the following code. In this case, I've got a really simple Front Controller (written in PHP). class frontController { public function routeRequest($oRequest) { $sClassname = $oReques...

Unit Tests for JPA/Persistence in General

How/would you test super-simple methods that are built on a persistence engine. I'm going to use JPA but any persistence mechanism I'm sure has its equivelents. For example... @Entity public class Category { @Id @GeneratedValue private long id; @NotNull @NotEmpty private String name; @NotNull @ManyToOne private ...

Global setup and teardown blocks in Test::Unit

What's the best way to have a setup run before every method in an entire test suite (not just one test class)? Rspec allows you to define global before and after blocks. Is there a clean comparable way to do this in Test::Unit that doesn't involve mixing a module into each test class? ...

TDD vs. Unit testing

My company is fairly new to unit testing our code. I've been reading about TDD and unit testing for some time and am convinced of their value. I've attempted to convince our team that TDD is worth the effort of learning and changing our mindsets on how we program but it is a struggle. Which brings me to my question(s). There are many...

How to test email sending using Rspec?

What are the best practices and tools to test email-sending using rspec with Rails? For instance, how do I test that an email has been sent or what should I test to have efficient testing and acceptable coverage. If you guys need an example, how would I go and test this: class UserMailer < ActionMailer::Base def jobdesc_has_been_re...

are scenarios/stories the new interface in BDD/TDD?

PHP is somewhat crippled since it doesn't have return types (yet). I need my code to throw an exception when X already exists. I can write this in a scenario, but I'm not able to go from the scenarios to the interface my class should implement. Actually this problem is the same in TDD I guess. There seems more that I can tell through my...

Help with TDD approach to a real world problem: linker

I'm trying to learn TDD. I've seen examples and discussions about how it's easy to TDD a coffee vending machine firmware from smallest possible functionality up. These examples are either primitive or very well thought-out, it's hard to tell right away. But here's a real world problem. Linker. A linker, at its simplest, reads one ob...