-
Notifications
You must be signed in to change notification settings - Fork 16
[FEATURE] Ui test #17
Comments
Hi @alorma , I'm really interested to hear how you would like to do testing. Because of the way we structure our screens (MVVM) I have been able to provide view tests for our viewfinder sample screen. Could you maybe provide some sudo code for a couple tests you would like to be able to write. |
UHm... yes, that sounds like the way i would do it :P I will try this weekend and tell u my results |
Maybe, the way I would do is be able to mock (or set) the barcode live data from KView instead of set it on ViewModel. So we can test our real ViewModel class wit it's usecases, or whatevere we use... Does it have sense to you? |
It makes sense, but I am not sure what value it adds. As it stands I believe you are still able to test the fragment (screen) and separately you would be able to test your viewmodel. Meaning you can cover both your classes. Are you trying to test the combined unit of the view and viewmodel? In which case, would the barcodeview not be considered part of your view and therefore not want to alter or mock it? I think it would be nice to be able to test at a higher level, by providing an input to the Android camera. But this doesn't seem possible. I'm not sure how possible it would be to add a method to the barcodeview which was only available in tests. I know you can add a testing annotation which should get lint to indicate that you shouldn't use it. But in terms of a more strict/forced way, I'm not sure if you can. |
Yes, I don't like it either... so i will check your solution and see if it fits what I need :D |
Great. Do let me know. I want this library to support people's testing needs as much as possible. |
Is your feature request related to a problem? Please describe.
Reading documentation i don't see any topic on how to use this view with UI testing (like Espresso).
Have you any tip that you can provide, so it's easy to do a test that request to scan a barcode?
Describe the solution you'd like
On test method:
The text was updated successfully, but these errors were encountered: