Open Bug 1730627 Opened 4 years ago Updated 4 years ago

Add tests for Java markers

Categories

(Core :: Gecko Profiler, task, P3)

Unspecified
Android
task

Tracking

()

People

(Reporter: mozbugz, Unassigned)

References

Details

Bug 1730622 showed that we need more test coverage of Java markers. (And maybe samples as well?)

Ideally, we should have some Android tests that can create Java markers, and checks that the final JSON output is correct.

I don't know enough about our Java automated testing capabilities to know if it's possible. Nazim, what do you think?

Flags: needinfo?(canaltinova)

Yes, I agree that we need more tests for the Java sampler + markers. Currently we don't have enough coverage for them. Historically we didn't have any tests for Java side because it's not easy to add a test for them since it's also not as easy to start and capture the profile in the Android side. We don't have the necessary APIs right now to have an end-to-end testing yet.

To test this, we need to write some JUnit tests. And to be able to test the profiler properly, we'll need to add startProfiler and and stopAndCaptureProfile APIs to the Android side since we don't have them yet. Also, we'll need to be able to parse the JSON string to a JSONObject in Java, which is possible like this. I think the biggest blockers are the APIs, but they shouldn't be too hard to implement. One caveat would be that we need to copy the strings when we pass them from C++ to Java (if I recall correctly) and it might be a problem for the JSON strings when we capture a profile.
I will try to take a look at that to see if I can quickly add those APIs and have some test, but I might need to prioritize my other projects first, and that might take longer. If anyone is interested in this, please let me know and I can help/mentor for this.

Flags: needinfo?(canaltinova)

Bug 1737376 is another example where tests could have prevented a regression! Luckily it was noticed quickly, and it's an easy fix.

Depends on: 1737376
You need to log in before you can comment on or make changes to this bug.