0

While migrating our build tool to Buck, we stumbled upon the following issues for the unit tests in Android:

Our tests for the view model need to access R.java for asserting the right resources are referenced.

We used the java_test rule but it seems R.java is not found. There is a robolectric_test which builds the .apk but we just want the R.java file in the classpath for the unit tests.

Is there a reason there is no android_test rule. Any plans of doing so?

We explored the code and looked that we need to see the AndroidLibraryGraphEnhancer and build the Android resources.

Any recommendations?

Nazneen
  • 266
  • 3
  • 16

1 Answers1

0

No plans for adding such rule because it's not clear what it supposed to do and why robolectric_test is not enough.

Buck doesn't build an apk for Robolectric tests.

You really don't want to use java_test to test Android code because Android SDK and Java SDK are different. You have to test Android code with robolectric_test because it uses Android SDK.

tcb
  • 2,745
  • 21
  • 20