tdd

Too Many Public Methods Forced by Test Driven Development

A very specific question from a novice to TDD: I seperate my tests and my app into different packages. Thus, most of my app methods have to be public for tests to access them. As I progress, it becomes obvious that some methods could become private, but if I make that change, the tests that access them won't work. Am I missing a step...

Mock versus Implementation. How to share both approaches in a single Test class ?

Hi, See the following Mock Test by using Spring/Spring-MVC public class OrderTest { // SimpleFormController private OrderController controller; private OrderService service; private MockHttpServletRequest request; @BeforeMethod public void setUp() { request = new MockHttpServletRequest(); re...

rails + rspec : Staying DRY when testing validations

Ok say I have the following model: class Country < ActiveRecord::Base validates_presence_of :name validates_presence_of :code end I'm doing the rspec unit tests for those validations. They look like this: it "should be invalid without a name" do country = Country.new(@valid_attributes.except(:name)) country.should_not b...

General N-Tier Architecture Question

In an N-Tier app you're supposed to have a business logic layer and a data access layer. Is it bad to simply have two assemblies: BusinessLogicLayer.dll and DataAccessLayer.dll to handle all this logic? How do you actually represent these layers. It seems silly, the way I've seen it, to have a BusinessLogic class library containing class...

Should a Unit-test replicate functionality or Test output?

I've run into this dilemma several times. Should my unit-tests duplicate the functionality of the method they are testing to verify its integrity? OR Should unit tests strive to test the method with numerous manually created instances of inputs and expected outputs? I'm mainly asking the question for situations where the method you are...

Explicit behavior with checks vs. implicit behavior

I'm not sure how to construct the question but I'm interested to know what do you guys think of the following situations and which one would you prefer. We're working at a client-server application with winforms. And we have a control that has some fields automatically calculated upon filling another field. So we're having a field curre...

DUnit: How to run tests?

How do i run TestCase's from the IDE? i created a new project, with a single, simple, form: unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) private public end; var Form1: TForm1; implementation {$R *.DFM} end. Now i'll add a...

Applying Test Driven Development to a tightly coupled architecture

Hi all, I've recently been studying TDD, attended a conference and have dabbled in few tests and already I'm 100% sold, I absolutely love it TDD. As a result I've raised this with my seniors and they are prepared to give it a chance, so they have tasked me with coming up with a way to implement TDD in the development of our enterprise...

What is the best place to find software development conference listings?

I am interested in an array of software ideas and use more than one language, is there somewhere that concisely lists software development conferences year by year? I'd like to know what options are out there for this year and searching by ideology/language isn't practical in my opinion to get an overall. Some ideologies/languages that...

TDD a controller with ASP.NET MVC 2, NUnit and Rhino Mocks

What would a simple unit test look like to confirm that a certain controller exists if I am using Rhino Mocks, NUnit and ASP.NET MVC 2? I'm trying to wrap my head around the concept of TDD, but I can't see to figure out how a simple test like "Controller XYZ Exists" would look. In addition, what would the unit test look like to test an...

I have Person.Surname field implemented as a string if I change the implementation of the field to an object none of my tests fail. How can I test that it is indeed a string?

This is me going right back to basics with TDD for learning purposes. I originally implemented Person.Surname as field of type object (the simplest possible way of passing the test. I then added a test setting Person.Surname stating that the return value should be a string and set Person.Surname=20. I 'fixed' the test by changing the ...

How do I get autotest (ZenTest) to see my namespaced stuff?

Autotest is supposed to map my tests to a class, I believe. When I have class Foo and class FooTest, autotest should see FooTest and say, "Hey, this test corresponds to the unit Foo, so I'll look for changes there and re-run tests when changes occur." And that works, however... When I have Foo::Bar and Foo::BarTest, autotest doesn't see...

TDD - How to start really thinking TDD?

I have been reading about Agile, XP methodologies and TDDs. I have been in projects which states it needs to do TDD, but most of the tests are somehow integration tests or during the course of project TDD is forgotten in effort to finish codes faster. So, as far as my case goes, I have written unit tests, but I find myself going to sta...

Have you been in cases where TDD increased development time?

Hello everyone :) I was reading http://stackoverflow.com/questions/2512504/tdd-how-to-start-really-thinking-tdd and I noticed many of the answers indicate that tests + application should take less time than just writing the application. In my experience, this is not true. My problem though is that some 90% of the code I write has a TON ...

How to use TDD in a not very "Testy" environment

I work in a company where OOP is... well, not fobidden, but at least frowned upon as "too complex". My coworkers write lots of 100+ lines functions and they are usually all in a "funcs.inc.php" or "something.inc.php", if they use any functions at all, often they don't since copy-paste is faster. I would love to start using TDD at least ...

How do I get developers to treat test code as "real" code?

In the last two companies I've been at, I have found an overriding mentality among developers that it's okay to write unit tests in a throw-away style. Code that they would never write in the actual product suddenly becomes OK in the unit tests. I'm talking Rampant copying and pasting between tests Code styling rules not followed Har...

Eclipse refresh taking too long

I am doing TDD on a large Java project in eclipse and am finding it frustrating because every time I run a test I have to wait 30 seconds+ for eclipse to compile and refresh. I estimate that 80%+ of that time is spent refreshing. Is there a way I can drastically reduce the amount of refreshing it is doing? I have looked at server other...

Where to start with the development of first database driven Web App (long question)?

Hi all, I've decided to develop a database driven web app, but I'm not sure where to start. The end goal of the project is three-fold: to learn new technologies and practices, deliver an unsolicited demo to management that would show how information that the company stores as office documents spread across a cumbersome network fold...

Are there common C# tdd frameworks working on Mono ?

Are there any unit-testing and mocking frameworks for C# that run on Mono ? ...

TDD and management

My manager is starting to get pretty annoyed that I'm devoting time to designing tests (he sees testing as something you do after the software is written.). His do I convince him otherwise? ...