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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T13:27:18+00:00 2026-05-10T13:27:18+00:00

I saw many questions asking ‘how’ to unit test in a specific language, but

  • 0

I saw many questions asking ‘how’ to unit test in a specific language, but no question asking ‘what’, ‘why’, and ‘when’.

  • What is it?
  • What does it do for me?
  • Why should I use it?
  • When should I use it (also when not)?
  • What are some common pitfalls and misconceptions
  • 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. 2026-05-10T13:27:19+00:00Added an answer on May 10, 2026 at 1:27 pm

    Unit testing is, roughly speaking, testing bits of your code in isolation with test code. The immediate advantages that come to mind are:

    • Running the tests becomes automate-able and repeatable
    • You can test at a much more granular level than point-and-click testing via a GUI

    Note that if your test code writes to a file, opens a database connection or does something over the network, it’s more appropriately categorized as an integration test. Integration tests are a good thing, but should not be confused with unit tests. Unit test code should be short, sweet and quick to execute.

    Another way to look at unit testing is that you write the tests first. This is known as Test-Driven Development (TDD for short). TDD brings additional advantages:

    • You don’t write speculative ‘I might need this in the future’ code — just enough to make the tests pass
    • The code you’ve written is always covered by tests
    • By writing the test first, you’re forced into thinking about how you want to call the code, which usually improves the design of the code in the long run.

    If you’re not doing unit testing now, I recommend you get started on it. Get a good book, practically any xUnit-book will do because the concepts are very much transferable between them.

    Sometimes writing unit tests can be painful. When it gets that way, try to find someone to help you, and resist the temptation to ‘just write the damn code’. Unit testing is a lot like washing the dishes. It’s not always pleasant, but it keeps your metaphorical kitchen clean, and you really want it to be clean. 🙂


    Edit: One misconception comes to mind, although I’m not sure if it’s so common. I’ve heard a project manager say that unit tests made the team write all the code twice. If it looks and feels that way, well, you’re doing it wrong. Not only does writing the tests usually speed up development, but it also gives you a convenient ‘now I’m done’ indicator that you wouldn’t have otherwise.

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

Sidebar

Ask A Question

Stats

  • Questions 123k
  • Answers 123k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Empty is a subset of any string. Think of them… May 12, 2026 at 1:04 am
  • Editorial Team
    Editorial Team added an answer In the mouseover event (or the first method of the… May 12, 2026 at 1:04 am
  • Editorial Team
    Editorial Team added an answer Your approach is perfectly valid (though I would use a… May 12, 2026 at 1:04 am

Related Questions

I saw many questions asking 'how' to unit test in a specific language, but
Ours is an upcoming company, so we cannot buy two three third party controls
Does anyone know of an easy 3D modeling application like sketchup but is opensource?
I actually have two questions regarding the same problem but I think it is
When I create shared libraries, I have a header file (but with no file

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.