The idea of this project is to help you start doing automation for cross platform Apps (Android & iOS).
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
If you want to run Things you need to install
- Java JDK with JAVA_HOME environment variable configured.
- Appium
- You can install it using npm
- Then you can run
npm install -g appium
- For Android: Android SDK with environment variables configured.
- For iOS: XCode
- IntelliJ IDEA (Community Version)
- Gitbash (Only if using windows)
Clone this repo:
https://github.com/fifernandez/basic-mobile-automation.git
Navigate to the repo folder and run
./gradlew build idea
Run IntelliJ and before opening the project
click on configure -> project defaults -> project structure.
Inside project sdk click on new and search the folder where you installed java sdk, and click on Ok.
Now go to configure -> plugins -> install jetbrains plugins.
Search cucumber for groovy and isntall it with all the other required plugins that intellij informs.
Close and restart when prompted.
Now lets open the project in IntelliJ
Click on open, search for the project folder and click on ok.
Wait for loading.
Click on import gradle project and click on ok.
Wait for loading.
On the menu bar clin on view -> tool windows -> project
folders : features and groovy must be marked as test sources root (green)
folders: resources must be marked as test resources root (yellow icon)
To start the Appium server, Open a console and run:
appium -a 127.0.0.1 -p 4444
Then ou can run the tests, open a different console (leave the previous one running) and run:
./gradlew cucumber -Pdevice=Android7
Same sample for iOS:
./gradlew cucumber -Pdevice=iPhone7
- -Pdevice: defines the model of the device you will run (real, simulator, emulator)
- Availables:
- iPhone7: Simulator for iPhone7 with ios 12.0
- Android7: Android Emulator with Android 7.0
- Android5: Android Emulator with Android 5.1.1
- You can add your models in GebConfig.groovy file.
- Availables:
- -Ptags: defines the scenario/s you want to run
- If not present then it will run for all
- The tag is define in the first line of the cucumber file
- Sample: -Ptags="@Boca"
- Write the features in the features folder
- Assign tags to them
- You can parametrize the scenario using 'Scenario Outline'
- Define your steps in the steps folder
- Parametrize buttons, fields, inputs so you can easily reuse steps
- Keep good organization of the files, it' a good idea to have one step file per page
- Create your pages/modules files in the groovy folder
- Make a good use of the Page Object pattern
- To config your drivers edit: GebConfig.groovy
- For changing cucumber configs edit: env.groovy
- Cucumber - For writing the tests scenarios
- Geb - For the browser automation
- Appium - For the Android driver
- Groovy - For writing the steps implementations
- Gradle - For building and running
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- Fran Fernandez - fifernandez
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details