-
Notifications
You must be signed in to change notification settings - Fork 671
Use of Dexter when running Roboelectric unit test #192
Comments
Hi @joreilly we don't have any shadow for Dexter and I don't think we need it. As Dexter is just a wrapper on top of the Android Permissions system, if you have a shadow for the Android SDK permissions API you won't need any shadow for this library. Is this the answer to your question? |
Hi @pedrovgs, I had thought that as well but get following crash when I unit test activity that uses Dexter
|
I have no idea how this is even possible... @Serchinastico any clue? |
Have you ever got a solution for this? We have a similar problem with Dexter 6.2.0 and roboletric 4.3.1 trying to run a unit test like this:
|
Hi @norbertschuler what you post there seems to be a crash in a forced downcasting :S My recommendation for you in this scenario is to wrap Dexter instances with a class and use a mock instead. This should be a valid workaround. Keep in mind you can use |
@pedrovgs Thank you, but we have omitted creating a mock for Dexter now and just use it directly in Robolectric. We just granted access to our PermissionsListener object to the unit test, so the test can call |
Is there any recommended way of using Dexter when running as part of Roboelectric unit test? For example, is there a shadow version of Dexter that can be used?
The text was updated successfully, but these errors were encountered: