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

  • Home
  • SEARCH
  • 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 782105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:20:02+00:00 2026-05-14T20:20:02+00:00

I understand the general idea about unit testing and have used it in scenarios

  • 0

I understand the general idea about unit testing and have used it in scenarios where complex interactions were happening in a system, but I still have a question about all of those principles coming together.

We are cautioned about not testing the framework, or the database. Good UI design does not lend itself to non-human testing. UI interaction in general is excluded in MVC frameworks. In many apps what is left?. 37signals talks about extensive unit testing, but in an app like Basecamp or Backpack, what exactly are the types of things being tested through appropriate unit tests? What would 100% code coverage mean in that scenario?

EDIT: I am not tearing down apps like Backpack – they are awesome, but the work seems to go more into the design and interaction instead of complex logic (in fact, they espouse that very idea). In those areas of that app, where CRUD and the hierarchy of which object is related to which pretty much cover it, is the appropriate amount of unit tests zero? Is the point of tests in that case to be another copy of the validation code (required, regex, etc.)?

  • 1 1 Answer
  • 1 View
  • 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-14T20:20:02+00:00Added an answer on May 14, 2026 at 8:20 pm

    TDD for business apps works like this.

    1. Write down a business requirement.

    2. Write down a test for that requirement.

    3. Write code that passes the test.

    The trick is that there are many junky non-business requirements that don’t need extensive testing.

    • “saves to a database” isn’t a business requirement. It’s technical.

    • “activates a button on the GUI for some situation” isn’t a business requirement, it’s part of the interface.

    • “backup” isn’t a business requirement; it’s security or business continuity or something.

    Consider a concrete example.

    Requirement — “You can’t borrow books until you’ve paid your fines.”

    Tests.

    1. Attempt to borrow book with fine.

    2. Attempt to borrow book with no fine.

    Code.

    class FinesNotPaid( unittest.TestCase ):
        def setUp( self ):
            # load some fixtures with users, books and fines outstanding.
        def test_should_not_checkout_book( self ):
            x = TheCheckoutClass()
            x.checkoutBook( someBook )
            self.fail( "Should have thrown error" )
    
    class FinesPaid( unittest.TestCase ):
        def setUp( self ):
            # load some fixtures with users, books and fines paid.
        def test_should_not_checkout_book( self ):
            x = TheCheckoutClass()
            x.checkoutBook( someBook )
            self.success(  )
    
    class NoFines( unittest.TestCase ):
        etc.
    

    These are Business Rules implemented by classes that are separate from your database and your GUI. These are classes in an application domain layer.

    Your CRUD rules are business rules. You need to test them. However, you don’t need to test every database-related feature. You need a few “can I create and persist an object?” tests. You have to trust that the ORM, the Data Access layer and the Database actually work. You don’t write tests to exhaustively test the built-in features of the ORM.

    Code coverage (100% or 80% or 10%) is largely meaningless. Is software that has tests with 80% code coverage actually 20% more likely to fail? It doesn’t work that way. Testing every line of code doesn’t cover every logic path, so stop worrying and start testing.

    Test the business use cases. If they pass and there’s untested code, then — perhaps — you wrote too much code.

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

Sidebar

Related Questions

everyone. I got general idea about RMI, but still need to understand some details.
I understand that in general it is a bad idea to start a new
I understand how to use REST for doing general entity interactions - using urls
I understand that some countries have laws regarding website accessibility. In general, what are
I understand what System.WeakReference does, but what I can't seem to grasp is a
I have a general idea of what existential quantification on types is and where
I understand that addEventListener isn't IE friendly, but I'm curious about this approach in
i understand the general idea of creating a class tag, such as .center or
I am just trying to get a general idea about the event prcessing mechanism
I'm trying to understand the MVC pattern and I get the general idea that

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.