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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:39:05+00:00 2026-05-24T19:39:05+00:00

I am learning about how to use JUnit but there is something that I

  • 0

I am learning about how to use JUnit but there is something that I still don’t understand. When you set up test cases, how do you determine the range of values to use to test a method out. I realize that it depends on the method, but given the huge number of possibilities with many methods (say one where the signature of the method is an int) how do you define a range of values that will adequately test the method. Are there guidelines, rules of thumb, etc. that might be useuful?

Thank you

  • 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-24T19:39:06+00:00Added an answer on May 24, 2026 at 7:39 pm

    Depending on the logic of the method you want to test, a rule of thumb is to have one test for the ‘regular’ case and one test for every corner case. For example, getSquareRoot(int n) you would create unit tests for a positive number that has an integer square root, one that has a square root with decimals, getSquareRoot of 0 and getSquareRoot of a negative number. Every test has to assert that the behavior equals what’s expected. So there’s no really added value to test with two values belonging to the same “case” for that method’s logic (e.g. getSquareRoot(4) and getSquareRoot(16) as they both return an integer). The example I gave maybe not the best one, but it’s just to illustrate the rule of thumb.

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

Sidebar

Related Questions

I'm still learning about jQuery, but I have not been able to find a
I am learning about pointers and one concept is troubling me. I understand that
I'm currently learning about class inheritance in my Java course and I don't understand
I'm just learning about dynamic memory allocation, but there is one thing i'd like
I'm working on a project in C#, it's about E-learning.This project should use plug-ins
I am just learning how to use Terracotta after discovering it about a month
I've just been learning about master pages in ASP.NET 2.0. They sound great, but
I have been learning about the basics of C# but haven't come across a
I have been learning about TDD (using JUnit) and I have a doubt about
I am still learning about programming as you can probably tell by my question.

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.