views:

159

answers:

6

Could TDD be oriented to another kind of testing different from unit testing?

+3  A: 

Behavior-Driven Development (BDD) applies the ideas of TDD at the integration testing and functional testing level.

undees
Thanks undessI was totally unaware of this kind of development : )
SDReyes
Good link, insightful!
nacmartin
I used to think like that.. I don't anymore :PWhere did you get that idea?
Maxwell Troy Milton King
About BDD, Max? : O
SDReyes
+2  A: 

Technically TDD is a way of doing things, not just about unit testing, in theory it should drive all the development process.

In theory the philosophy is that testing drives development, for a more complex scenario, like integration between systems, you should define the integration test, then code to pass those integration tests (even if the test are not automated)...

Jorge Córdoba
Thanks Jorge,A great point.
SDReyes
+5  A: 

While that might be possible under some interpretation of TDD, I think the main point of TDD is to write the tests before any production code. Given that, you won't have a large system to write integration or functional tests for, so the testing is necessarily going to be on the unit level.

calmh
Thats a nice point... : )anyway could we develop software using functional tests? I think we canwhat do you think?
SDReyes
Well, yes, I don't see any principal problem with "moving up a notch" and only testing the functional requirements.You might end up with difficulties getting the system equally well tested. For example a system composed of two units, where each would require four unit tests, could require sixteen functional tests to achieve the same level of coverage. Increase the number of components, and the required functional-level testing to make sure all cases are covered will explode.I guess I'm saying that if you want excellent test coverage, which TDD proposes, you probably need unit tests.
calmh
Agree Calmh, that finally could lead us to a TDD strongly related to unit testing, for efficiency.Thank you very much : )
SDReyes
I write tests cases as an interpretation of the spec at the same time the developers are writing the code. If I finish the test documentation before they finish the code, I'll give them the documentation to try out. This has the same effect as TDD; A good number of bugs are found and fixed before QA. We've even caught spec misinterpretations and saved ourselves some costly late rewrites.This is done in parallel instead of testing coming first, but based on my experience I would say, yes, it is possible use a form of TDD with other kinds of testing.
JamesH
+1  A: 

Of course YES. TDD relies on automated tests which is an orthogonal concern to the 'type' of tests.

Maxwell Troy Milton King
I personally agree +1 : )
SDReyes
+2  A: 

The red-green-refactor cycle of TDD is supposed to be quick, really quick. Fast feedback keeps you in the groove. I've seen approaches to TDD that take a full story, express it as a test, then drive development to pass that (large-ish) test. It's nominally TDD (or maybe BDD), but it doesn't feel right to me. Tiny steps, unit tests, is how I learned TDD, how I think of it, and how it works best for me.

Carl Manaster
Thanks for answer Carl.Yep, by experience Unit Testing could work better.BDD could be a fat guy : PThanks again.SD
SDReyes
A: 

Hey.
If you concentrate on idea, not technical realization, than yes. What I'm saying is if,just for a moment, you forget about unit testing, and focus on idea of writing tests first, before writing implementation in order to achieve clearer design than it can be done even on system level.

Imagine this, you have some requirements. Based on that you write User Acceptance Testing tests - tests on high level that capture functionality. Next you start development - you already have use cases in form of UAT test. You know exactly what is expected, so it is easier to implement desired functionality.

Other example is project based on scrum. In planning meeting you discuss/create/have user stories that are later developed during sprint. Those user stories can actually be UAT tests.

Anyway way I see TDD as way of specifying design upfront, not application testing cycle/phase/methodology. Reason why TDD is perceived as synonym for unit testing is that unit tests are as close to developer as possible. They seem natural way for developer to express functional design of a class/method.

yoosiba