OneStopTesting - Quality Testing Jobs, eBooks, Articles, FAQs, Training Institutes, Testing Software, Testing downloads, testing news, testing tools, learn testing, manual testing, automated testing, load runner, winrunner, test director, silk test, STLC

Forum| Contact Us| Testimonials| Sitemap| Employee Referrals| News| Articles| Feedback| Enquiry
 
Testing Resources
 
  • Testing Articles
  • Testing Books
  • Testing Certification
  • Testing FAQs
  • Testing Downloads
  • Testing Interview Questions
  • Career In Software Testing
  • Testing Jobs
  • Testing Job Consultants
  • Testing News
  • Testing Training Institutes
  •  
    Fundamentals
     
  • Introduction
  • Designing Test Cases
  • Developing Test Cases
  • Writing Test Cases
  • Test Case Templates
  • Purpose
  • What Is a Good Test Case?
  • Test Specifications
  • UML
  • Scenario Testing
  • Test Script
  • Test Summary Report
  • Test Data
  • Defect Tracking
  •  
    Software testing
     
  • Testing Forum
  • Introduction
  • Testing Start Process
  • Testing Stop Process
  • Testing Strategy
  • Risk Analysis
  • Software Listings
  • Test Metrics
  • Release Life Cycle
  • Interoperability Testing
  • Extreme Programming
  • Cyclomatic Complexity
  • Equivalence Partitioning
  • Error Guessing
  • Boundary Value Analysis
  • Traceability Matrix
  •  
    SDLC Models
     
  • Introduction
  • Waterfall Model
  • Iterative Model
  • V-Model
  • Spiral Model
  • Big Bang Model
  • RAD Model
  • Prototyping Model
  •  
    Software Testing Types
     
  • Static Testing
  • Dynamic Testing
  • Blackbox Testing
  • Whitebox Testing
  • Unit Testing
  • Requirements Testing
  • Regression Testing
  • Error Handling Testing
  • Manual support Testing
  • Intersystem Testing
  • Control Testing
  • Parallel Testing
  • Volume Testing
  • Stress Testing
  • Performance Testing
  • Agile Testing
  • Localization Testing
  • Globalization Testing
  • Internationalization Testing
  •  
    Test Plan
     
  • Introduction
  • Test Plan Development
  • Test Plan Template
  • Regional Differences
  • Criticism
  • Hardware Development
  • IEEE 829-1998
  • Testing Without a TestPlan
  •  
    Code Coverage
     
  • Introduction
  • Measures
  • Working
  • Statement Coverage
  • Branch Coverage
  • Path Coverage
  • Coverage criteria
  • Code coverage in practice
  • Tools
  • Features
  •  
    Quality Management
     
  • Introduction
  • Components
  • Capability Maturity Model
  • CMMI
  • Six Sigma
  •  
    Project Management
     
  • Introduction
  • PM Activities
  • Project Control Variables
  • PM Methodology
  • PM Phases
  • PM Templates
  • Agile PM
  •  
    Automated Testing Tools
     
  • Quick Test Professional
  • WinRunner
  • LoadRunner
  • Test Director
  • Silk Test
  • Test Partner
  • Rational Robot
  •  
    Performance Testing Tools
     
  • Apache JMeter
  • Rational Performance Tester
  • LoadRunner
  • NeoLoad
  • WAPT
  • WebLOAD
  • Loadster
  • OpenSTA
  • LoadUI
  • Appvance
  • Loadstorm
  • LoadImpact
  • QEngine
  • Httperf
  • CloudTest
  •  
    Languages
     
  • Perl Testing
  • Python Testing
  • JUnit Testing
  • Unix Shell Scripting
  •  
    Automation Framework
     
  • Introduction
  • Keyword-driven Testing
  • Data-driven Testing
  •  
    Configuration Management
     
  • History
  • What is CM?
  • Meaning of CM
  • Graphically Representation
  • Traditional CM
  • CM Activities
  • Tools
  •  
    Articles
     
  • What Is Software Testing?
  • Effective Defect Reports
  • Software Security
  • Tracking Defects
  • Bug Report
  • Web Testing
  • Exploratory Testing
  • Good Test Case
  • Write a Test
  • Code Coverage
  • WinRunner vs. QuickTest
  • Web Testing Tools
  • Automated Testing
  • Testing Estimation Process
  • Quality Assurance
  • The Interview Guide
  • Upgrade Path Testing
  • Priority and Severity of Bug
  • Three Questions About Bug
  •    
     
    Home » Testing Articles » Manual Testing Articles » Unit Testing: Is there any debate any longer?

    Unit Testing: Is there any debate any longer?

    A D V E R T I S E M E N T


    On a panel several years ago, I was asked what was the greatest benefit that Agile had delivered to me personally. It took me no time to respond "unit testing." (While this answer is not historically accurate � unit testing precedes the Agile movement � it's clear that the Agile exponents made it a widespread practice. In large part, because of Kent Beck's lapidary JUnit implementation, which has been widely copied to most major languages.)

    The specific benefit I � and many other developers � have enjoyed is quite simply less time spent in the debugger. Today (and for years now), I write code and then I write unit tests that exercise the edge cases and one or two main cases. Right away, I can tell if I missed something obvious or if my implementation has a slight burble that mishandles cases I expected to flow through easily.

    This doesn't mean I can assert that I now feel comfortable my code is right. But what I do know is that it's better because it's been partially tested. The result of this is that the long sessions in the debugger trying to find why, for example, some data packets have an unexpected zero in the last byte, are pretty much done with. An error like that � invalid values or an improper format � will be caught right away by my tests. Previously, I'd have to wait for the bug to surface, then trap it, back up through code, examine and test it, and keep following the data up the call chain only to discover that at the very start when I created a substring, I miscounted by one the number of bytes to extract. Those days of 3 AM debugging are gone. Most of my debugger sessions today are about logic errors that transcend the unit level. I am happier and more productive.

    I also enjoy another considerable advantage that I did not have prior to unit tests. As the collection of tests grows, the tests themselves become monitors of sorts that watch over my code to make sure it has not shifted unexpectedly beneath me. Because my code coverage is in the 75%-80% range, I have a lot of these monitors watching out for me. I run them all as a regression sequence any time I make a change that might have more than local impact. When I make a big change, I can tell right away if I have unhooked anything. For example, the other day, I changed the name of a major package. There were references to it throughout my code base. I had the IDE do the refactoring. When the compilation worked the first time, I felt a first measure of comfort. When all the unit tests passed, I had a high level of confidence that the change had been implemented non-disruptively. Without unit tests, I would never have made the change, because of the risk that it would cause problems for me far down the chain.

    These benefits are not unique to me. Many Agilists view tests as enabling flexible development. In fact, the edgier subset among the Agilists won't code at all unless they have tests written beforehand. This approach is called Test-Driven Development (TDD), which they swear by, but which does not appeal to me. Regardless, the fundamental recognition that by writing unit tests, you assure yourself of the ability to make major changes easily is indeed a universal recognition.

    However, the recognition is not universally embraced. A reader recently wrote to me, grousing about the current vogue that so values unit tests. His view was that the test are a waste of time. I've heard this view before. Unit testing has not been a waste of time for me, because the time it costs to write the tests is recovered from the shortened debugging cycle. And I gain the ability to make changes to the code with confidence. But the classic complaints often point to exactly such large changes. Namely, that if � in the Agile spirit � you throw away a bunch of code because of a shifting requirement, you also have to throw out a bunch of unit tests. Because unit tests typically represent 50%-75% of the size of the code base, you're chucking 1.6x code, say, for every 1x that needs to be changed. This is true, of course, but there's no way out of that bind. I could write untested code that I dreaded to debug and then I could feel better about having to dump it. But that's not exactly a happy place either.

    One place where the complaint rings true is psychologically. The more code you've written, the more attached you become to it and the less you're willing to throw it away. And tests only add to this resistance. But the reality is that code is rarely stripped off and dumped en masse. Rather, some pieces are replaced selectively and others are modified. In this process, tests once again help assure that the code works as expected.

    Most organizations today use unit tests in varying degrees. In a recent talk, Jeff Atwood of Coding Horror fame said he uses tests selectively � mostly when he's testing package interfaces. Others, as I pointed out, are more committed to their use throughout a project. If you're among the hold-outs who don't use unit tests at all, you're missing an excellent opportunity to make your code better and to improve your coding experience. As I said earlier, of all the practices the Agile revolution has brought to the mainstream, this is probably the one that will save you the most time and aggravation. 



    More Manual Testing Articles



    discussionDiscussion Center
    Discuss
    Discuss

    Query

    Feedback
    Yahoo Groups
    Y! Group
    Sirfdosti Groups
    Sirfdosti
    Contact Us
    Contact

    Looking for Software Testing eBooks and Interview Questions? Join now and get it FREE!
     
    A D V E R T I S E M E N T
       
       

    Members Login


    Email ID:
    Password:


    Forgot Password
    New User
       
       
    Testing Interview Questions
  • General Testing
  • Automation Testing
  • Manual Testing
  • Software Development Life Cycle
  • Software Testing Life Cycle
  • Testing Models
  • Automated Testing Tools
  • Silk Test
  • Win Runner
  •    
       
    Testing Highlights

  • Software Testing Ebooks
  • Testing Jobs
  • Testing Frequently Asked Questions
  • Testing News
  • Testing Interview Questions
  • Testing Jobs
  • Testing Companies
  • Testing Job Consultants
  • ISTQB Certification Questions
  •    
       
    Interview Questions

  • WinRunner
  • LoadRunner
  • SilkTest
  • TestDirector
  • General Testing Questions
  •    
       
    Resources

  • Testing Forum
  • Downloads
  • E-Books
  • Testing Jobs
  • Testing Interview Questions
  • Testing Tools Questions
  • Testing Jobs
  • A-Z Knowledge
  •    
    Planning
    for
    Study ABROAD ?


    Study Abroad


    Vyom Network : Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Programming & Source Codes | Free eBooks | Job Interview Questions | Free Tutorials | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Bangalore Info | GATE Preparation | MBA Preparation | Free SAP Training
    Privacy Policy | Terms and Conditions
    Sitemap | Sitemap (XML)
    Job Interview Questions | Placement Papers | SMS Jokes | C++ Interview Questions | C Interview Questions | Web Hosting
    German | French | Portugese | Italian