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 279701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:03:17+00:00 2026-05-12T05:03:17+00:00

Possible Duplicates: What is unit testing and how do you do it? What is

  • 0

Possible Duplicates:
What is unit testing and how do you do it?
What is unit testing?

I recognize that to 95% of you, this is a very WTF question.

So. What’s a unit test? I understand that essentially you’re attempting to isolate atomic functionality but how do you test for that? When is it necessary? When is it ridiculous?
Can you give an example? (Preferably in C? I mostly hear about it from Java devs on this site so maybe this is specific to Object Oriented languages? I really don’t know.)

I know many programmers swear by unit testing religiously. What’s it all about?

EDIT: Also, what’s the ratio of time you typically spend writing unit tests to time spent writing new code?

  • 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-12T05:03:18+00:00Added an answer on May 12, 2026 at 5:03 am

    I’m Java now, before that C++, before that C. I am entirely convinced that every piece of work I have done, that I am now unashamed of, was enhanced by the testing strategies I picked. Skimping the testing hurts.

    I’m sure that you test the code you write. What techniques do you use? For example, you might sit in a debugger and step through the code and watch what happens. You might execute the code against some test data someone gave you. You might devise particular inputs because you know that your code has some interesting behaviours for certain input values. Suppose your stuff uses someone else’s stuff and that’s not ready yet, you mock up their code so that your code can work with at least some fake answers

    In all cases you may be to some degree Unit Testing. The last one is particulalry interesting – you are very much testing in isolation, testing your UNIT, even if theirs is not yet ready.

    My opinion:

    1). Tests that can easily be rerun are very useful – catch no end of late creeping defects.
    In contrast testing sitting in a debugger is mind-numbing.

    2). The activity of constructing interesting tests as you write your code, or BEFORE you write your code makes you focus on your fringe cases. Those annoying zero and null inputs, those “off by one errors”. I perceive better code coming out as a result of good unit tests.

    3). There is a cost of maintaining the tests. Generally it’s worth it, but don’t underestimate the efforrt of keeping them working.

    4). There can be a tendency to over-ephasise Unit Tests. The really interesting bugs tend ot creep in when pieces are integrated. You replace that library you mocked with the real thing and Lo! It doesn’t quite do what it said on the tin. ALso there is still a role for manual or exploartory testing. The insightful human tester finds special defects.

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

Sidebar

Ask A Question

Stats

  • Questions 192k
  • Answers 193k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think the idea here would be to store the… May 12, 2026 at 6:28 pm
  • Editorial Team
    Editorial Team added an answer You're basically attaching a click event handler twice to the… May 12, 2026 at 6:28 pm
  • Editorial Team
    Editorial Team added an answer Types of empty (from PHP Manual). The following are considered… May 12, 2026 at 6:28 pm

Related Questions

Possible Duplicate: How do you mock out the file system in C# for unit
Its been a while I have ready Mcconnell's Code Complete . Now I read
Possible Duplicate: How do you generate dynamic (parameterized) unit tests in Python? Is there
Joining an existing team with a large codebase already in place can be daunting.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.