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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:54:56+00:00 2026-05-16T17:54:56+00:00

Time elapsed (time taken?) to run(and pass) my Junit test case is shown as

  • 0

Time elapsed (time taken?) to run(and pass) my Junit test case is shown as 0.00. I have tried failing the test case (by doing assertEquals for a wrong value) and its still showing time elapsed as 0.00.

The rest of test cases have non-zero time elapsed values.

EDIT: Assumption – I assumed that it would surely take non-zero time to execute and that if it didn’t happen, nothing was happening within the test case – example, I have a if condition in there and no corresponding else. So, if the condition failed, it just came out of the method without doing anything and since an error didn’t occur, it didn’t fail the test either.

Is there any reason this is happening? Am I missing something?

Thanks,
Pratyusha.

  • 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-16T17:54:57+00:00Added an answer on May 16, 2026 at 5:54 pm

    It’s not clear why you think it should be non-zero. Is it possible that your test case is just passing (or failing) really quickly?

    Just for the sake of experimentation, put a Thread.sleep(1000) call in there… if that changes things, it suggests that everything’s fine and your test is just fast.

    Are all your test methods shown to be executing? It’s not something simple like failing to annotate the methods or failing to keep to the naming convention of testXXX (depending on which version of JUnit you’re using)?

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

Sidebar

Related Questions

I've come across a unit test that is failing intermittently because the time elapsed
I'm using time elapsed as a variable in a program which I am currently
I want to be able to show the elapsed time in a textview or
I am using boost::format variable to get elapsed time in seconds boost::posix_time::time_duration total_time =
I found an example of QueryPerformanceCounter, http://advancedcppwithexamples.blogspot.com/2009/08/measuring-elapsed-time-in-c-using_21.html The example measures a sleep of 100ms
Is there a way to embed the last command's elapsed wall time in a
Application Specific Information: com.my-app failed to launch in time Elapsed total CPU time (seconds):
I have php scripts that I have to run on linux as well as
Possible Duplicate: fast elapsed time on linux How can I measure how long a
The following loop is taking a lot of time to run. If I comment

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.