Parsely / parsely-android

The official Parse.ly Android toolkit -- for instrumenting your apps with Parse.ly
https://docs.parse.ly/android-sdk/
Other
6 stars 6 forks source link

Add setup for functional tests. Test sending events over the local variable limit. #85

Closed wzieba closed 1 year ago

wzieba commented 1 year ago

Description

This PR adds a setup for writing and running functional tests on CI. Contrary to unit tests, they are meant to be written via black-box technique. The only mocked/faked element of the setup is API, which is intentionally mocked via MockWebServer.

Additionally, it adds a test case for tracking number of events exceeding maximum number of events that are stored in memory. This asserts correctness of saving/querying data from the local file as well as shows the benefits of functional tests.

Note

Important pivot how to approach the proposed test was made in 8d4a0d39e04b57a6a05bb260e6978e23905c7c12 so please don't pay a lot of attention to implementation details introduced in commit before, which is e97a7a5c3c9ffd2bf75b6b986969e231e021a09a.

How to test

Green light on CI should be enough. You can also download the build artifact and see results of instrumentation tests.

codecov[bot] commented 1 year ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (2bec4fe) 44.23% compared to head (e6727a0) 44.38%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #85 +/- ## ========================================== + Coverage 44.23% 44.38% +0.15% ========================================== Files 8 8 Lines 364 365 +1 Branches 56 56 ========================================== + Hits 161 162 +1 Misses 189 189 Partials 14 14 ``` | [Files](https://app.codecov.io/gh/Parsely/parsely-android/pull/85?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Parsely) | Coverage Δ | | |---|---|---| | [...ava/com/parsely/parselyandroid/ParselyTracker.java](https://app.codecov.io/gh/Parsely/parsely-android/pull/85?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Parsely#diff-cGFyc2VseS9zcmMvbWFpbi9qYXZhL2NvbS9wYXJzZWx5L3BhcnNlbHlhbmRyb2lkL1BhcnNlbHlUcmFja2VyLmphdmE=) | `11.89% <100.00%> (+0.47%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.