#Test Coverage Results Question

1 messages · Page 1 of 1 (latest)

frigid fable
#

When you are writing tests, and viewing the coverage we have three main points of data.

  1. Class Percent
  2. Method Percent
  3. Line Percent

Is there some sort of rule I should follow for what percent is satisfactory? Or should you strive for 100% test coverage?

lofty plinthBOT
#

<@&987246399047479336> please have a look, thanks.

lofty plinthBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

frigid fable
#

I read the magic number is anything above 80% is considered good but I feel like that’s a per basis suggestion

#

Because I feel like for 100% test coverage, you begin testing of java is actually doing it’s job

burnt hill
#

Depends on the threshold your given, my projects for graduate had to have 90 coverage. Going for 100% is only possible on tiny tiny projects or your going to have to do massive reflection to get into errors or just code u had to place for logging purposes. Also coverage is not saying anything, just that the program passed the code.

#

( Example is -> Program running as intended, then an issue arises with database where it sends back garbled instructions )

rugged mirage
#

My code, which had 100% coverage, had a bug 🤣

#

Which is why 100% coverage doesn't necessarily mean anything

#

Aiming for a high number is good, but making sure you're actually testing the right things is better (which sometimes means writing tests that contribute nearly nothing to coverage, but cover another use case instead)

lofty plinthBOT
#

Closed the thread due to inactivity.

If your question was not resolved yet, feel free to just post a message to reopen it, or create a new thread. But try to improve the quality of your question to make it easier to help you 👍

frigid fable
rugged mirage
#

I stick to line / branch coverage (idk if the latter is always computed)