Testing on selector filefrom the CommonsWare Community archives
At December 23, 2019, 3:26pm, Pvr asked:
I have used selector in my component implementation. I want to know How to perform testing on selector files
At December 23, 2019, 10:35pm, mmurphy replied:
If by “selector” you mean a
StateListDrawable… that is a resource. Usually, we do not test resources. We might test the application of a resource, such as testing the results of inflating a layout, but usually we have a difficult enough time finding time to test actual code.
In the specific case of a
StateListDrawable… in theory you could write an instrumented test that uses
findStateDrawableIndex() to try to determine if you wrote the selection rules correctly. I have never done this and I do not know if would be practical.