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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:48:44+00:00 2026-05-10T14:48:44+00:00

Does anyone know of where to find unit testing guidelines and recommendations? I’d like

  • 0

Does anyone know of where to find unit testing guidelines and recommendations? I’d like to have something which addresses the following types of topics (for example):

  • Should tests be in the same project as application logic?
  • Should I have test classes to mirror my logic classes or should I have only as many test classes as I feel I need to have?
  • How should I name my test classes, methods, and projects (if they go in different projects)
  • Should private, protected, and internal methods be tested, or just those that are publicly accessible?
  • Should unit and integration tests be separated?
  • Is there a good reason not to have 100% test coverage?

What am I not asking about that I should be?

An online resource would be best.

  • 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-10T14:48:45+00:00Added an answer on May 10, 2026 at 2:48 pm

    I would recommend Kent Beck’s book on TDD.

    Also, you need to go to Martin Fowler’s site. He has a lot of good information about testing as well.

    We are pretty big on TDD so I will answer the questions in that light.

    Should tests be in the same project as application logic?

    Typically we keep our tests in the same solution, but we break tests into seperate DLL’s/Projects that mirror the DLL’s/Projects they are testing, but maintain namespaces with the tests being in a sub namespace. Example: Common / Common.Tests

    Should I have test classes to mirror my logic classes or should I have only as many test classes as I feel I need to have?

    Yes, your tests should be created before any classes are created, and by definition you should only test a single unit in isolation. Therefore you should have a test class for each class in your solution.

    How should I name my test classes, methods, and projects (if they go in different projects)

    I like to emphasize that behavior is what is being tested so I typically name test classes after the SUT. For example if I had a User class I would name the test class like so:

    public class UserBehavior 

    Methods should be named to describe the behavior that you expect.

    public void ShouldBeAbleToSetUserFirstName() 

    Projects can be named however you want but usually you want it to be fairly obvious which project it is testing. See previous answer about project organization.

    Should private, protected, and internal methods be tested, or just those that are publicly accessible?

    Again you want tests to assert expected behavior as if you were a 3rd party consumer of the objects being tested. If you test internal implementation details then your tests will be brittle. You want your test to give you the freedom to refactor without worrying about breaking existing functionality. If your test know about implementation details then you will have to change your tests if those details change.

    Should unit and integration tests be separated?

    Yes, unit tests need to be isolated from acceptance and integration tests. Separation of concerns applies to tests as well.

    Is there a good reason not to have 100% test coverage?

    I wouldn’t get to hung up on the 100% code coverage thing. 100% code coverage tends to imply some level of quality in the tests, but that is a myth. You can have terrible tests and still get 100% coverage. I would instead rely on a good Test First mentality. If you always write a test before you write a line of code then you will ensure 100% coverage so it becomes a moot point.

    In general if you focus on describing the full behavioral scope of the class then you will have nothing to worry about. If you make code coverage a metric then lazy programmers will simply do just enough to meet that mark and you will still have crappy tests. Instead rely heavily on peer reviews where the tests are reviewed as well.

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

Sidebar

Ask A Question

Stats

  • Questions 72k
  • Answers 72k
  • 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
  • added an answer I'm not sure if this is the best way, but… May 11, 2026 at 1:43 pm
  • added an answer DELIMITER $$ CREATE FUNCTION MY_FUNCTION (FILENAME VARCHAR(255)) RETURNS VARCHAR(255) DETERMINISTIC… May 11, 2026 at 1:43 pm
  • added an answer See the topic 'Using Messages and Message Queues' in MSDN… May 11, 2026 at 1:43 pm

Related Questions

No related questions found

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.