tdd

ActiveMailer test pass when run through ruby but not when rake test:units

Hi All - I'm having trouble with an activemailer test I created. When I run the test directly with ruby, the test passes. When I run all the unit tests they fail, because the way the message is encoded changed. Running the test from rake test:units breaks the email into multiple mimeparts, that do not exist when running ruby unit/mail...

is it practically possible to do good TDD (or BDD) without using any DI framework in java?

IMO one of the main characteristics of a good TDD is: testing your class (or actually unit) in isolation. When you do so, you are able to actually test single behavior in each test -- only one test will fall for a single problem you have. For this you first must verify that there are no static references from your class (including cons...

Can you use Test Driven Development on UI updates?

We are starting to using Test Driven Development on a project. We use jQuery, so I figured that QUnit would be a good TDD tool. The drawback is, to test UI enhancement with QUnit, you would have to recreate the UI units on the test page, which doesn't seem like a real test. One of my co-workers feels like we may be able to find a TD...

BDD with Cucumber and rspec - when is this redundant?

A Rails/tool specific version of: How deep are your unit tests? Right now, I currently write: Cucumber features (integration tests) - these test against the HTML/JS that is returned by our app, but sometimes also tests other things, like calls to third-party services. RSpec controller tests (functional tests), originally only if the c...

Is there how I could revert to the code that last built/tested successfully?

Developing in NetBeans with Maven I often keep reverting back to local history and svn code as things no longer work (TDD?). Other than committing to a 'testing new idea X' branch after each successful build/test is there how I could configure Maven to do that at each build automatically? Is anyone else running into the same issue, and ...

How to speed up TDD flow with iOS and Objective-C/Xcode

Have been searching for experiences on TDD with Objective-C and iOS development. Previous post about "string calculator"-kata in Objective-C was useful (thanks). But it would be nice to learn even more fluent iPhone-TDD. Do you have some experience of how to use UISpec (based on Rspec), iCuke (based on cucumber) or similar tools? An...

How can I test an interface without implementing it first?

I am trying to see how test cases can drive interface design. Now, if I have an interface with a method: public interface UserService { User getNextUser(); } and if UserServiceImpl is an implementation of UserService, then as per my understanding of mock objects, I should only mock the dependencies of the UserServiceImpl, like a User...

Unit testing: is "good enough" good enough?

I have a unit test that can spontaneously fail 1 in 1,000,000 (guesstimation) times even when there is no fault in the code. Is this an acceptable tolerance or does the TDD manifesto requires iron fisted absoluteness? Just for those who are interested it goes something like this stuff = randomCrap.get() stuff2 = randomCrap.get() asser...

Patterns for loading default data when unit testing

Looking for some strategies for how you guys are loading default data when doing unit tests. ...

Can cxxtest suite be dynamically extended at run-time?

I wish to dynamically extend my CxxTest Suite with additional test items, but am finding that all the testing scenerios must be available (hard-coded) at compile time. My scenario is that I've got a fairly bulky C++ class that has 20+ methods to be tested. This class needs to be tested for 40+ DIFFERENT data sets. These data sets are ...

How would you test this code? (phpUnit)

How would you test the following code with phpUnit? class Product { protected $id = null; public function __construct($id) { $this->id = $id; } public function getDescription($language_id) { $db_query = mysql_query("SELECT * FROM products_description WHERE products_id = " . (int) $this->id . " AND lang...

How to effectively (not) test service layer

In one of our service classes I have a bunch of methods which just return the DAO result with no processing like public void acceptRequest(User from, User to) { rosterDAO.acceptRequest(from, to); } The unit test for this method looks like this private final RosterDAO rosterDAO = context.mock(RosterDAO.class); ... public void tes...

How to test that objects get updated using a fake repository

Say I have the following business logic: foreach (var item in repository.GetAll()) { if (SomeConditition) { item.Status = Status.Completed; repository.Update(item); } } Now I write the following unit test: public void Test() { var repository = new FakeReposit...

Could not connect to remote facade url

I am trying to use mxunit eclipse plug-in for testing my test cases. I am using eclipse 3.6.0 with cfml plug-in (cfeclipse ver 1.4.2.*) For ColdFusion project. On the fifth step of plug-in configuration, I get the following error: Could not connect to facade URL. Try running this in a browser: http://localhost/mxunit/framework/Remote...

Django load test fixtures with django-nose

How do you load test fixtures using the django-nose test runner? ...

Effective testing in C++ with stubs and mocks? (possible?)

I'm looking for some style advice for testing this piece of (Objective-)C++ code, I bracketed the Objective part, as I don't think it should have any bearing on this test. class Probe { public: bool playing(); } bool Probe::playing() { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; iTunesApplication *iTunes = [S...

"Zero Iteration" - end to end acceptance test in simple contact-form feature

I was reading "Growing Object-Oriented Software, Guided by Tests" lately. Authors of this book sugested to always start developing a feature with an end-to-end acceptance test (before starting TDD cycle) to not loose a track of progress and to make sure that you're still on the same page while unit-testing. Ok, so I've start writing a v...

Confused on TDD wrappers/adapters

Hi, I'm new to the TDD scene and trying to isolate my tests is having me go around in circles. I have an app I am trying to write that uses OpenXML so it has a mass of objects that it depends on to work from an external framework. I thought it would be a good idea to have wrappers around these objects so I was isolated from them in ca...

Unit testing the hibernate mapping file

Just curious to know if there is any framework that helps to test the hibernate mapping schema. I've found ORMUnit, used in "POJOs in Action", but it doesn't seem to be in use much. Is there any other framework that people use to make sure that the classes are mapped properly to the database schema, or is this something that people don...

How to avoid accessors in test-driven development?

I'm learning test-driven development, and I have noticed that it forces loosely coupled objects, which is basically a good thing. However, this also sometimes forces me to provide accessors for properties I wouldn't need normally, and I think most people on SO agree that accessors are usually a sign of bad design. Is this inevitable when...