This Repo contains the source code for the 'Mail Order Coffeeshop app'. The MailOrder Coffeeshop app was built for Android App test automation practice.
In order to run this app you'll need a way to download this project, an IDE, and a Android device or Emulator. Using Android Studio and Git is recommended:
If you're familiar with Git, then you should know what to do.
Fork
it to your personalGithub account
and create anew branch
- When the
clone
is finished you're all set to open the project.
Android Studio is Google's IDE that's made for Android app development. Follow the installation instructions on the Android Studio website: [https://developer.android.com/studio/install] (https://developer.android.com/studio/install)
- Open android studio
- Select "Open an existing Android Studio project"
- Browse to the directory where you saved the project and open it:
- This is the point where Android Studio may ask you a few questions about the setup of your IDE and/or a few project related questions. If you don't know what to do, most of the time accepting the (default) suggestions is fine.
- Time to see if everything works: This is what the project structure should look like in Android Studio:
If it doesn't look like this, there are a few thing you can do:
- Check in the bottom bar of Android Studio if Gradle is still syncing, downloading dependencies etc. If it is, wait a few minutes.
- Make sure the project pane is open (click the "1: Project" button on the left side).
- Make sure the 'Android' view is selected in the drop down menu at the top.
If all else fails:
- From the file menu select Invalidate Caches / Restart.. (and invalidate the caches and restart)
- From the Build menu select Clean Project
- From the build menu select Rebuild project
- If you haven't already: setup a device or emulator so you can run the app
- Run the app to test if everything was downloaded and imported correctly: Press the 'play' icon in the top right corner of Android Studio, make sure "app" is selected in the drop-down menu.
- In Android Studio select the Tools menu and then 'AVD Manager'.
- Click the '+ Create Virtual Device' button.
- Select a device from the list, for example Nexus 5X, and click 'Next'
- Select a system image. I'd go with one of the recommended images (Pie, API 28) and click 'Next'
- Give the virtual device a name and click 'Finish'
Note: downloading the files for the emulator may take a while.
Developer options on your device should be enabled so we can use usb debug mode and disable animations. Debug mode allows Android Studio to recognize the device, and turning animations off is a recommended practice for mobile test automation. If turned on, animation may cause unexpected delays and test failures.
Instructions may differ for different manufacturers. In general, this works*:
- Open de Settings app;
- (Android 8.0 or higher) Select system;
- Scroll to the bottom and select About Phone;
- Scroll to the bottom and tap Build Number 7 times;
- Return to the previous screen to find Developer options near the bottom.
NOTE: To avoid flakiness, we highly recommend that you turn off system animations on the virtual or physical devices used for testing.
On your device, under Settings > Developer options, disable the following 3
settings:
- Window animation scale
- Transition animation scale
- Animator duration scale
- Use
Java
OrKotlin
- Use Espresso for writing Android UI tests
Goto to app/src/androidTest/java/de/deliveryhero/mailordercoffeeshop
you will find EspressoWorkshopTest
and here you can start writing your tests
- Close the
Onboarding
screen - Click on
Menu
- Select
CAPPUCCINO
- Enter
your Name
andyour email
- Click
Submit Order