-
-
Notifications
You must be signed in to change notification settings - Fork 448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running Code Coverage #865
Comments
As a quick update: I've successfully generated code coverage for Kiwix Android on bitbar's cloud. To do this I ended up creating a fresh project, partly as I couldn't see a way to change the configuration for the current project (I'll ask the Bitbar team for their advice on whether we can do this). The coverage file is generated and placed in the |
I think the various prerequisites are now in place for us to enable code coverage for our tests that run on Bitbar's device cloud. They have updated their systems, API, and gradle plugin bitbar/android-gradle-plugin#28 so that we can now specify we want to use their test framework that enables the code coverage file to be generated when the tests are run. They also fixed some bugs in their scripts e.g. which meant the video recordings weren't generated initially when they generated code coverage (they're not mutually exclusive, it was just a bug introduced accidentally when they implemented the code coverage feature). I've created and tested a new 'Project', as they're called by Bitbar, which has the same set of devices as we currently use. To implement the change in our codebase we need to:
We may need to also specify the new Project which we'd do in 2 places:
These changes might not be absolutely necessary owing to the nature of how Bitbar currently implemented their changes, nonetheless if we do apply these changes the overall understanding will be clearer (we specify we want to run the code coverage test framework on the project that has test coverage enabled when it was created). There are a bunch of details I'm eliding here related to how to create and revise projects in Bitbar's system vs. how we've configured our scripts to run the tests and obtain the results. Details on the testdroid Gradle plugin are available in their project's README https://github.com/bitbar/testdroid-gradle-plugin And the various releases of their plugin are available at https://github.com/bitbar/testdroid-gradle-plugin/releases |
Note: my interim code changes are in a local branch julianharty/enable_code_coverage_without_breaking_debugging |
@julianharty Have you pushed that branch? |
@mhutti1 I hadn't, got distracted last week with dental treatment and dealing with family stuff. I can see you've made some major changes with #1016 which breaks my changes. I've had a go at setting the frameworkId and running the tests - I'm able to run the tests |
Yeah so basically our run configuration has now been moved to a separate file where we call the API directly. I have shared the repo with you (its private for now). We can change the framework Id and other config options in https://github.com/mhutti1/kiwix-test-gateway/blob/master/runtest.php#L26 and we should have even more control than before. With regards to running the coverage variant. We can probably set testBuildType with an enviromental var set by travis but debug by default. |
@mhutti1 Excellent and thank you for sharing the repo. Would you mind changing the frameworkId to |
Sounds good. I will try to get this working. |
@mhutti1 Would it be helpful if I came to London and/or we arrange a pairing session somehow so we can break the back of this work? Just ask, I can make the time to help get this done. Thank you. |
Hey, yeah I'm very busy this and next week with Uni Exams + GSoC Enquires, I am open to suggestions but can't spend a huge amount of time on this for two weeks :( |
@julianharty I have made the framework changes and submitted a pr to change the default build #1137 to test this. It works and can be seen in Auto Test 2282 on the Kiwix project on testdroid. As mentioned this breaks debugging so I will try to configure this option on the fly to use debug locally and coverage on travis. |
@mhutti1 Excellent, thank you. I can see the From what I understand this file needs to be processed together with the intermediate build files (I don't yet know if the coverage report is generated from the source files, the class files, or a mix) if the coverage report is to be accurate. Anyway, we're at least one step closer :) BTW: You'd mentioned in another issue #1116 that Google have finally added support for a default build target, perhaps we can find a way to implement support for both? |
Resolved by #1176 , closing |
This is related to issue #836 which focuses on enabling the generation of code coverage reports. I've decided to create this issue where I/we can focus on how (and perhaps also where) the code coverage reports can and will be generated as there are distinct topics such as:
As a starting point: in a discussion with @kelson42 he would prefer code coverage to be generated periodically and the reports hosted externally. He doesn't want them to be generated on each pull request.
There seem to be various logistical challenges in terms of configuring and generating code coverage. Also the code coverage results in one or more files being created on the Android device, sometimes in a private directory/folder. We'll need to adapt our approach so it works despite these restrictions and challenges.
The text was updated successfully, but these errors were encountered: