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

The Archive Base Latest Questions

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

Q: how to detect real test coverage ? I’ve noticed one problem with code

  • 0

Q: how to detect real test coverage ?

I’ve noticed one problem with code coverage metric and test quality: 100% code coverage doesn’t mean that code is really tested.

Sometimes test gives 100% coverage even that it doesn’t cover everything. Problem lays in coverage definition, we assume coverage==reachable code.

But it’s not true, code could be 100% reachable but not 100% covered with the test.

Take a look into example, this test gives 100% coverage (EMMA), but in reality it doesn’t cover values which will be passed to service mock. So, if value will be changed, test won’t fail.

Example:

public class User {
  public static final int INT_VALUE = 1;
  public static final boolean BOOLEAN_VALUE = false;
  public static final String STRING_VALUE = "";
  private Service service;

  public void setService(Service service) {
      this.service = service;
  }

  public String userMethod() {
      return service.doSomething(INT_VALUE, BOOLEAN_VALUE, STRING_VALUE);
  }
}

And test for it:

public class UserTest {

  private User user;
  private Service easyMockNiceMock;

  @Before
  public void setUp() throws Exception {
      user = new User();
      easyMockNiceMock = EasyMock.createNiceMock(Service.class);
  }

  @Test
  public void nonCoverage() throws Exception {
      // given
      user.setService(easyMockNiceMock);
      expect(easyMockNiceMock.doSomething(anyInt(), anyBoolean(), (String) anyObject())).andReturn("");
      replay(easyMockNiceMock);
      // when
      user.userMethod();
      // then
      verify(easyMockNiceMock);
  }
}
  • 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-01T19:30:08+00:00Added an answer on June 1, 2026 at 7:30 pm

    Take a look at Jester, which performs mutation testing. From the site:

    Jester finds code that is not covered by tests. Jester makes some
    change to your code, runs your tests, and if the tests pass Jester
    displays a message saying what it changed. Jester includes a script
    for generating web pages that show the changes made that did not cause
    the tests to fail.

    Jester is different than code coverage tools, because it can find code
    that is executed by the running of tests but not actually tested.
    Jester’s approach is called mutation testing or automated error
    seeding. However, Jester is not meant as a replacement for code
    coverage tools, merely as a complementary approach.

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

Sidebar

Related Questions

I'm looking for a real time memory tracker library (or considering writing one) that
I'm testing code that is designed to detect when a child process has segfaulted.
How can I detect if a system supports hardware virtualization via code? (Preferably in
Our QA team uses HP Quality Center for defect tracking, test plans, etc. The
Is there a way to detect whether we are running on emulator or real
I am currently working on an application that should be able to detect wifi
I'm working on a simple WP7 app that displays BART arrivals from their real
How to detect whether a file is modified in iOS? I don't mean the
Is there a way to detect that a DirectShow filtergraph has reached the end
Is there any way to detect in java code whether or not the code

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.