I am trying to write some JUnits for my application, I believe I have got around 80% code coverage, but when i run the tests my report looks as follows;
This is giving me a code coverage result of 52% which is not idea.
Is there an alternative way to write the methods in which an exception is expected so as to maintain my coverage score?
Thanks
Don't worry about code coverage of Tests only the code coverage of the source code (not test code).
If you are using emma or jaCoCo, you can use filters to only instrument or report the results of specific classes or directories.
This is much easier to do if you have separate folders for src and test
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With