This project shows how to read the QRCode content from an Android App using Appium and ZXing.
- Java as the programming language
- Appium as the mobile test automation tool
- Zxing as the library to decode the QRCode content
- AssertJ as the assertion library
- JUnit 5 as the test tool to support the test automation script
- Java JDK >=11
- Android Emulator with
minSdkVersion
used as 16 (Android 4.1 Jelly Bean)
- Go do the project directory and run
mvn verify -Dmaven.test.skip=true
- Run
mvn test
to run the test
- Open this project in your preferred IDE
- Open the
ReadQRCodeTest
class placed insrc/test/java
- Run the test
You can expect a successful execution. The test will read the QRCode content and assert by its expectation.
The code does the following:
- Open an Android Emulator (if it's not opened)
- Install the apk placed on
app
folder - Open the app main screen
- Takes a screenshot of the screen that has the QrCode
- Send the QRCode screenshot, as Base64, to be decoded by ZXing
- Return the QRCode content
- Assert the QRCode content
Attention You need to have all the necessary configurations to run the test. This project has no intention to describe how you can do it.