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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:30:42+00:00 2026-06-01T16:30:42+00:00

I have situation where there are multiple test cases which uses a common method.

  • 0

I have situation where there are multiple test cases which uses a common method. So in order to avoid DRY(Don’t repeat yourself) i put them into a util class. So now do i need to write a test case for the the util class. All the util class contains is reading a particular file and returning its contents.

Thanks,
Sriram

  • 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-06-01T16:30:44+00:00Added an answer on June 1, 2026 at 4:30 pm

    The general rule is: test as much as you need until you are satisfied that your program is correct.

    How would an incorrect utility class for testing affect the behavior of the program? I don’t know about your specific program, but an incorrect utility class for testing can’t affect the correctness of your program. Instead, it can make you think that your program is correct when it really isn’t, or think that it’s incorrect when it’s really correct. So my instinct for utility classes for testing is not to test the class directly, but to go through a mental proof process and determine that the utility methods are correct and therefore won’t trick me into a mistaken belief about program correctness.

    Especially in your case, where the utility class only reads a file and returns its contents, you probably don’t need to write test cases. Code this simple should be easy to verify correct, so mentally proving correctness will be cheaper than writing test cases.

    N.B. Going through a mental proof process for all code is rather helpful. Some of the trendy “tricks” for debugging, like rubber duck debugging, are really just ways of forcing yourself to prove (at least in your mind) that pieces of your code are correct, or at least not blatantly incorrect.

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

Sidebar

Related Questions

I have a following situation in my project. There are some tag values which
I have this situation: There are a login page with a login form (form
I have the following situation: There is one custom view inside of the first
Let's say I have a situation in Silverlight where there is a background thread
I have the following situation. Assuming there are 3 systems: A,B,C and A is
I have a really tough situation in here. There is an array of these
I have situation where I have to handle multiple live UDP streams in the
I have a situation with my MVC2 app where I have multiple pages that
I have the following situation: There is a windows folder that has been mounted
I have a situation like below in which I have some problem in freeing

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.