18

I have an Android fingerprint implementation working and I was looking to add UI tests with Espresso. One problem I can't find a solution to is how to emulate the scanning of a finger. There is an adb command adb -e emu finger touch which should work on emulators.

Any idea on how to integrate something like that with Espresso?

QuirijnGB
  • 811
  • 1
  • 9
  • 18

1 Answers1

1

From this question sending to an emulator is possible:

Runtime.getRuntime().exec("adb -e emu finger touch 1")

I expect, though can't show any working, that faking a fingerprint on a real device would require some special kind of security magic.

Edit: this doesn't work from within espresso tests.

jamesh
  • 19,863
  • 14
  • 56
  • 96
  • You can use Kaspresso to do this though. We use their ADB server to send adb commands and normal commands. https://github.com/KasperskyLab/Kaspresso val result = adbServer.performAdb("-e emu finger touch 1") assert(result[0].contains("exitCode=0, message=OK")) – SamIAmHarris Aug 18 '23 at 07:59