Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6018445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:16:36+00:00 2026-05-23T03:16:36+00:00

I read a lot of question and answer on TDD and unit testing on

  • 0

I read a lot of question and answer on TDD and unit testing on SO but I found nothing that answer to that: where do I start from?

Me and team already done a couple of project in which we adopted the use of unit testing, for our code… but code first and then unit testing. At some point of the development process, it became quite natural to write the test first and then the code, bringing us to a more TDD style.

Now we would like to make the next step and try to start a new project with TDD from the beginning. Here’s the problem… where to start from? Which is the first test I’d write when I have no code at all?

Let’s say, just to have a context to think about, that I have to develop an internet application, document-centric, with a little work flow and… something else.
But let’s start from the beginning: first thing, I want to create a simple page that list all the document (metadata) stored in a table on a DB (quite simple, uh?).
Which is the first test I’d write? Let’s say that I’m using Hibernate to access the db… would I test the ipothetical method getAllDocuments()? But should I use a mock object to substitute Hibernate? So what am I testing?

I’m a little confuse here… moreover the getAlDocuments() probably will never be a production method… all the collection of documents will be ordered and filtered by something… does it make sense?
Any suggestion will be appreciated

Edited:

After reading your answers (and the similar thread at http://programmers.stackexchange.com) I come with a better vision of TDD, but I still have a dubt.

I always though TDD is about making unit test first… never thought about end-to-end test.
But let me ask: TDD say you have to write a test and see a compilation error; then you create class and method and you get a test failure; then you implement the method and get the test passed. You cannot write code until there’s a test that fail; you cannot write another test until all test pass. Am I right here?

How can I make an end-to-end test as my first test? I should write all the code, in all the layer, to let that test passed. But then I’ll have a bunch of classes and methods all tested by my end-to-end test (shouldn’t I call it integration test though?). This means I won’t need unit test anymore, because I already have a test that cover my code. And I can’t write a test that pass already, it’s against TDD pratice.

Help me understand this further step ahead please

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:16:36+00:00Added an answer on May 23, 2026 at 3:16 am

    TDD is not about unit testing – TDD is about driving your development and architecture with tests – with any type of automated tests you need. Do you see the point?

    You are starting a new project and you probably have a set of features. You should have some acceptance criteria for features you are going to implement. These criteria can define your top level tests. Let’s start either with an end-to-end test (this can be quite hard sometimes because it involves UI which doesn’t exist yet) or integration test for these acceptance criteria. Once you have test which is failing you will continue to implement features related to the large test but each this feature will be again driven either with an integration or an unit test. The feature is completed if all top level tests pass.

    If you skip large tests (end-to-end, integration) you will develop set of well tested units which will either do not work when integrated together or your architecture will not be very good because of local scope defined by unit tests. Integration and end-to-end tests give you a global scope.

    This is described with large example (Java) in the book Growing Object-Oriented Software Guided by Tests.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I read a lot of posts that convinced me I should start writing unit
Edit: From another question I provided an answer that has links to a lot
I've already read this but it doesn't answer to my question. Here's my scenario:
EDIT: Read answer number 1 from Tim Schmelter and then use this question for
I got question about log4net is it working on IIS 7,5? I read lot
I read a lot of questions on here but couldn't figure out what the
I've read lot of articles saying, that Java EE is most popular enterprise solution
I read a lot, also here, but couldn't find a simple way to do
I read a lot about changing the metadata of music or images, but what
This question has been asked a lot of times in many forums. But I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.