Skip to content
This repository was archived by the owner on Nov 10, 2026. It is now read-only.

Use instrumented tests for skip android test --apk - #201

Merged
marcprux merged 19 commits into
mainfrom
fix-test-apk
Mar 5, 2026
Merged

marcprux merged 19 commits into
mainfrom
fix-test-apk

Conversation

@marcprux

@marcprux marcprux commented Mar 3, 2026 •

Copy link
Copy Markdown
Member

This PR improves on #199 by using instrumented tests to run the test cases. This simplifies things because instrumented tests can stream their test output directly back to the adb shell am instrument command that launches it, as opposed to having to pass everything through logcat with adb shell am start and having the test client need to watch adb logcat for the expected messages. It also means that we can remove the extra C module from the generated Package.swift, since we no longer need to implement a NativeActivity.

The down side is that we now need a Java shim class, since it isn't possible to implement android.app.Instrumentation purely in native code, and we need to use some gnarly JNI to communicate between the Java and the Swift. Plus, we need to javac and d8 the class and manually include it in the .apk. This is regrettable but unavoidable, and the benefits of using proper instrumented testing rather than performing testing through an app is worth the extra complexity, IMO.

@cla-bot cla-bot Bot added the cla-signed label Mar 3, 2026
@marcprux marcprux changed the title Improve APK testing architecture build Use instrumented tests for skip android test --apk Mar 4, 2026
@marcprux
marcprux merged commit ab29054 into main Mar 5, 2026
10 checks passed
@marcprux marcprux mentioned this pull request Mar 5, 2026
2 of 5 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant