86839

difference between code coverage and profiling

What is difference between code code coverage and profiling.

Which is the best open source tool for code coverage.

Answer1:

Coverage is important to see which parts of the code have not been run. In my experience it has to be accumulated over multiple use cases, because any single run of the software will only use some of the code.

Profiling means different things at different times. Sometimes it means measuring performance. Sometimes it means diagnosing memory leaks. Sometimes it means getting visibility into multi-threading or other low-level activities.

When the goal is to improve software performance, by finding so-called "bottlenecks" and fixing them, don't just settle for any profiler, not even necessarily a highly-recommended or venerable one. It is essential to use the kind that gets the right kind of information and presents it to you the right way, because there is a lot of confusion about this. More on that subject.

Added: For a coverage tool, I've always done it myself. In nearly every routine and basic block, I insert a call like this: Utils.CovTest("file name, routine name, comment that tells what's being done here"). The routine records the fact that it was called, and when the program finishes, all those comments are appended to a text file. Then there's a post-processing step where that file is "subtracted" from a complete list (gotten by a grep-like program). The result is a list of what hasn't been tested, requiring additional test cases.

When not doing coverage testing, Utils.CovTest does nothing. I leave it out of the innermost loops anyway, so it doesn't affect performance much. In C and C++, I do it with a macro that, during normal use, expands to nothing.

Answer2:

Code coverage is an assessment of how much of your code has been run. This is used to see how well your tests have exercised your code.

Profiling is used to see how various parts of your code perform.

The tools depend on the language and platform you are using. I'm guessing that you are using Java, so recommend CodeCover. Though you may find NoUnit easier to use.

Recommend

  • Using a TensorFlow .pb graph as a Keras Model
  • The speed of fscanf and sscanf
  • The meaning of returning false from onDown()
  • Determining the radius of turtle clusters and number of turtles in them - postprocessing
  • How to create a circular buffer in MATLAB for continuous measurements in the correct order
  • Are there non-sampling time-profiling tools for iPhone apps?
  • Configuring many One-To-One relationships with Entity Framework Code First and Fluent API
  • c++ / Qt - computation time
  • Chef: Force use of modified attributes in template
  • Replacing NULL value in current row based on 'closest' matching 'earlier' row. (
  • Infinite loop in Doctrine event listener when trying to save additional entity
  • How to prevent certain internal routes from being accessed by the user?
  • Easy way to profile Magento API calls
  • Is there a list of URL schemes?
  • How to improve this function?
  • VisualVM profiling hangs while instrumenting classes
  • LibGit2Sharp log remote
  • Index on every Foreign Key?
  • Javascript and VERY LONG string
  • JHipster Entity Generator crahing
  • Pandas multi-index subtract from value based on value in other column
  • draw pie chart using iOS quartz 2D
  • dm-script catch error with “Analyze Particles”
  • How can I have an actor running on one process send a message to another actor running on a separate
  • How to set a thread specific environment variable in Python?
  • Slicing an SPA into several components and use AngularJS
  • UWP/C# - Issue with AQS and USB Devices
  • How to make JSON.NET deserialize to Microsoft Date Time?
  • Sequential (transactional) API calls in angular 4 with state management
  • one Local Olampyad Questions on Informatic in 2011
  • Can Jackson SerializationFeature be overridden per field or class?
  • Finding past revisions of files in StarTeam w/ .NET SDK / C#
  • Redux, normalised entities and lodash merge
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Why winpcap requires both .lib and .dll to run?
  • Android Studio and gradle
  • How to set the response of a form post action to a iframe source?
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • unknown Exception android
  • How to get NHibernate ISession to cache entity not retrieved by primary key