Showing failure build due to decreased coverage.

Hello community, I have been working on this ticket https://issues.openmrs.org/browse/TRUNK-295. After making the changes and running a maven clean package it was a success on my local machine however on creating a PR it passed the travis CI but then showed an error indicating covered decreased. Could I be briefed on what could be failure cause and suggestions on how to go about it. Here is the PR https://github.com/openmrs/openmrs-core/pull/2963 Thanks

hi @lgilbert, the coverage Indicator , basically shows the percentage of the lines of code corvered by unit tests . When you add in a line of code ,without adding in a unit test for , coverage will Decrease , and the coverage Indicator will show failure . I have looked at your PR , and the coverage Decrease
>> Coverage decreased (-0.03%) is very minor.After role ,its not that you added a new feature or a modification . No worries about that. But its a good practice to write a unit test for line of code you write. see TDD, that is incase you need to add a new feature , fix a bug or modify a feature

2 Likes

Alright. Thanks @mozzy for this. So maybe to ask, do I need to make any further changes ? To make it pass

1 Like

Ovcourse increasing coverage, means writing more unit tests , but for your case , just ignore the decrease as long as Travis passes.

1 Like

Because from the git comments, @dkayiwa had mentioned about running it using the reference application. So if I can also learn that it would be good for me. Is there any link pointing to that as well?

1 Like

that wasnt related to fixing the coverage failure. He meant running your changes in an actual local openmrs installation

1 Like

Okay. That’s something am going to tryout. Thanks once again

About unit testing , take a look at this doc

1 Like

Alright then. This is a great reference. Am grateful

1 Like