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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:02:27+00:00 2026-05-13T01:02:27+00:00

Several tools exists that allow to calculate path coverage for a set of tests,

  • 0

Several tools exists that allow to calculate path coverage for a set of tests, but is there a tool (or an algorithm) that could suggest values to get the best path coverage with the smallest number of tests possible?

For example with the following classes:

public class User {

    private boolean isAdmin = false;
    private String name;
    private String password;

    public User(String name, String password, boolean isAdmin) {
        this.name = name;
        this.password = password;
        this.isAdmin = isAdmin;
    }

    public boolean isAdmin() {
        return isAdmin;
    }

    public boolean authenticate(String name, String password) {
        if (name.equals(this.name) && password.equals(this.password)) {
        return true;
        } else {
            return false;
        }
    }
}

public class DataRepository {

    List<String> data = new ArrayList<String>();

    public void add(String dataPiece) {
        data.add(dataPiece);
    }

    public void clearAll(User userAuthenticated) {
        if (userAuthenticated.isAdmin()) {
            data.clear();
        }
    }

    public void addAll(User userAuthenticated, List<String> collection) {
        if (userAuthenticated.isAdmin()) {
            data.addAll(collection);
        }
    }
}

I will get a better test coverage if i create a test which is using a User with isAdmin at true.

Is there a tool that could mention: if you create a test with User with isAdmin at true you will get the best test coverage.

Something like that but for more complicated cases, and that checks all the branches of 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-13T01:02:27+00:00Added an answer on May 13, 2026 at 1:02 am

    To answer your question about suggesting values for tests, you could possibly take a look at Agitar (http://www.agitar.com/). I remember having a presentation about it yonks ago and I’m sure it has changed (hopefully for the better) since then, but it might be what you’re looking for. I, myself, would continue to go down the route of TDD and the other things I mentioned in my other answer, but if you’re interested, here’s a little part of what the Agitar site has to say:

    “The AgitarOne product family helps you work safer, better, and smarter as you develop and maintain your Java applications. AgitarOne JUnit Generator creates thorough JUnit tests on your code. This helps you find regressions and makes it safer and easier to improve your code to reduce the cost to maintain it.”

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

Sidebar

Related Questions

I have several applications that are part of a suite of tools that various
We're building tools to mine information from the web. We have several pieces, such
Looking for suggestions on file system management tools. We have several terabytes of images,
Several of my ajax applications in the past have used GET request but now
Several times now I've been faced with plans from a team that wants to
Several questions about functional programming languages have got me thinking about whether XSLT is
Several frameworks for writing web-based desktop-like applications have recently appeared. E.g. SproutCore and Cappuccino
Several years back, I innocently tried to write a little app to save my
Several extensions offer a bottom window for viewing their content. Firebug and ScribeFire are
Several people round here recommended switching to the new WD Velociraptor 10000rpm harddisk. Also

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.