You're reading from Mobile Test Automation with Appium
In Behavior Driven Development (BDD), the prime focus is on writing acceptance tests that describe the behavior of the application or system. Acceptance tests are written from a customer point of view and hence bring in the outside-in approach to the understanding and testing of the application. The emphasis is on making the test cases readable by everyone on the team so that any stakeholder can give feedback on the application's behavior.
Eric Evans, in his book Domain Driven Design (http://www.amazon.in/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215), talks about the need for one language to bridge the gap between the domain experts and programmers on the team. Cucumber helps enforce the ubiquitous language within the team, which can be understood by anyone on the team. Cucumber tests are written in a language that can be understood by anyone in the team, and it's implementation tests the application. This way, Cucumber helps a team express the...
In Chapter 5, we entered Package name
and Launch Activity
to launch Appium Inspector for an app already installed on the emulator. Let's learn how to find this information from an app.
We can follow two approaches to get the same result. The first approach requires you to have Play Store
and the app under test (Quikr
in our case) installed on your mobile.
Follow the given steps to find out the package information:
- Launch the Emulator/Device
- Launch
Google Play Store
- Search for an app
ManifestViewer
in Play Store and install it:
- Once installed, launch the
ManifestViewer
app - Under the
Application
sections and scroll down to the Quikr app:
- Once done, tap on the
Quikr
app, and it will show you these options:
- Click on the Look the
AndroidManifest.xml
option - This will load the manifest properties, as illustrated:
- This file will have details like
package
andactivity
Genymotion is one of the fastest Android emulators available for use. One drawback of using Genymotion is that it comes without the Google Play Store and Google apps. This means that some of the apps for testing that require the Google Play services framework may not work on the emulator.
However, the good news is that we can install Google Play services by following these steps:
- Start the Genymotion emulator
- Based on the Android version configured for the emulator, we need to download the flash-able Google Play services
gapps-lp-yyyymmdd-signed.zip
file fromThis installs Google Play services on the Genymotion emulator.
- Click on
OK
and reboot the emulator - Once the device is rebooted, you will notice that the Google Apps will start showing in the emulator
- To install Google Play Store on the device, we need to download the Play Store installer
com.android.vending-Major.Minor.Hotfix
APK file and install it on the emulator - Once done, launch...
In this Appendix, we covered different topics for a deeper insight into Cucumber. We learned about how Cucumber works and the importance of BDD, and we gained a deep insight into Gherkin and the different keywords Gherkin exposes. We also learned what hooks are and how to use them. We learned the different ways of running Cucumber tests.
We also learned how to look up an Android package name and find out different activities for an app. This is needed when we want to launch the Appium session on a pre-existing app on an Android device. We also learned how we can find the package name and Launch Activity from Appium itself.
We learnt that the Genymotion emulator doesn't come with Google Play services installed. We learned how to flash the device with the Google apps installer file and to install Google Play services on the Genymotion emulator.