Adding code coverage tool

We can use coveralls or codecov along with Circle CI to track code coverage as a part of the build process. It also adds a badge similar to the slack or build, displaying the current code coverage which I think can be a huge motivation for writing more test cases in order to increase code coverage.

1 Like

Does anyone have a preference between the two proposed tools or another to suggest?

@Shobhit_Agarwal, I think you said you'd be willing to make this happen for Collect, Briefcase and JavaRosa, right? I bet @daveycrockett and @dcbriccetti (aka Dávìds) have some opinions on code coverage tools.

My general sense is that it's dangerous to set code coverage targets because that can result in poor-quality tests. That said, the tools can help identify regions of code that need more testing and provide a reminder to add tests where possible. And it will also make it easier to celebrate folks who are adding good tests (@jamesknight :tada:).

1 Like

I love IDEA’s code coverage tools. I’m not familiar with CI ones. Good point about avoiding tests that only serve to raise the numbers (jukin’ the stats).

Ha ha: “Dávìds”

Hi Shobhit,

i like what you do.

in fact i want to say thank you

you are great.

Best Regards

Hi, @Nader. It feels really great to know that you liked the work we do here. Thanks for your support. :smile:

2 Likes

No additional knowledge from this Dávìd, I've only ever used a Jenkins plugin for Java test coverage. Also agree coverage targets == bad, but transparency into where there are big gaps == good. Slight preference for codecov because it has a green little gremlin mascot (but more seriously, are there any pros/cons we're aware of between the two? They're both free).

2 Likes

LOL @ gremlin.

Good question -- @Shobhit_Agarwal do you have a preference between the two tools and if so, why? Both will work with CircleCI, right?

@LN I have only worked with coveralls for a python project along with Travis CI. Both of these tools are compatible with Circle CI. Also, I don't have a personal favourite as I haven't worked with all of them .

Codecov seems to be having a lot more to offer in terms of features and stability.

A few links that could help us decide are here and here.

2 Likes

Thanks, @smartyrad! I did just a little bit of looking around and I agree with your conclusion.

I like the easy setup with CircleCI and the nice examples shared on their GitHub repo. The browser extension is also quite cool.

@Shobhit_Agarwal how about you make a final decision and let us know here. @yanokwa can create an opendatakit account and you two can work together to do whatever setup is needed.

1 Like

@LN I agree with @smartyrad too.
@yanokwa Let's do this

I have implemented it on my forked repo. codecov dashboard for this repo

3 Likes

Thanks for your leadership here @Shobhit_Agarwal!

I think this is a fantastic idea and I believe I've got this set up properly on the opendatakit GIthub page. Can you send in a PR for Collect with the changes on your fork so I can verify?

Once that gets going, then you can apply it to Briefcase, JavaRosa, and Build so we have a good view of our code coverage.

2 Likes
1 Like

Thanks to @Shobhit_Agarwal, we can now see that Collect has an impressive 5% test coverage!! :confounded:

@Shobhit_Agarwal do you want to get this going for Briefcase and JavaRosa?

3 Likes

The current test coverage is not including the unit test cases(all of the widgets tests too) which are using roboElectricTests/Mockito. I have added an issue for the same on the GitHub repo and investigating this issue. Currently, I don't have Briefcase and Javarosa environment setup on my system, so I will send a PR for them after setting them up locally.

3 Likes