Skip to content

JS/Kotlin integration tests #5589

@gnprice

Description

@gnprice

We should have some tests that run our Kotlin code and our JS code together, for areas where they interact.

  • An existing place this would be useful is for notifications: FcmMessage.kt at MessageFcmMessage#dataForOpen constructs an object which src/notification/types.js describes and src/notification/notifOpen.js consumes. That alignment is currently backed only by comments in each place pointing to the other one, and by manual testing when we edit that code.

    We don't often edit that code, though, and rarely by outside contributors, which is why that's been an acceptable state of affairs to date.

  • This will become much more important with Read our stored Redux data from Kotlin #5117. With that subsystem, the interaction between JS and Kotlin would be potentially broken whenever we make changes to the schema (whenever we add a migration in src/storage/migrations.js).

    That's something we do routinely, and that all code contributors regularly do -- it's in our new-feature tutorial for that reason. So relying on carefulness and manual testing would be too unreliable and costly, and we'll need automated tests.

The way to build these tests will probably be as Android instrumented tests: the test harness will make a special build of the app, install it on an Android device (physical or emulated), and run it there. This special build has the app's code on hand, but also test code, which sits in the driver's seat.

RN itself has some tests (in react-native:ReactAndroid/src/androidTest/; see on GH, or tree node_modules/react-native/ReactAndroid/src/androidTest/) which take this form: the Java test framework is in charge, the Java test code invokes JS, and JS test code answers back. So we'll take those as a model.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions