In Part 1, I introduced the concept of mobile automation testing, discussed key challenges and then laid the ground for why I chose Appium as my preferred framework for Salesforce1 mobile automation. In Part 2, I explained how to use Appium Inspector and showed with a demo how you can automate the oAuth dance for Salesforce1 Mobile SDK apps.
Now, let’s get down to business – the key operations in any mobile app are some sort of CRUD (Create, Read, Update, Delete) operations. Let’s explore how we can leverage Appium to automate these flows without actually writing a single line of code!
Create
Let’s do Create first. Going back to the Account Editor operation, the key with automating the Create operation is to
- Get focus on the Create button
- Fire the tap event on Create button
- Get focus on fields in Create button
- Fire tap event on these fields
- Put in relevant values for fields and then propagate it using ‘Send Keys’
- And finally select the ‘Create’ button and fire the tap event on it
Let’s see a video of how this is done
Delete
The Delete flow is very similar. The steps involved are
- Select the record that you want to delete
- Focus on Delete button
- Fire the Tap event on Delete button
Let’s see this in action now.
Read & Update
For the Read and Update flow, the steps involved are
- Select the record that you want to update
- This shows the record (covers the ‘Read’ part)
- Focus on the field you want to update
- Enter the updated value and then propagate it using ‘Send Keys’
- Focus on the Save button
- Fire the Tap event on Save button
Time to update some records!
Since Appium uses the WebDriver JSON protocol, it does not really matter if your app is a native app or a hybrid app. No knowledge of the code is required as long as you’re able to select UI elements using the Appium Inspector as shown above.
What’s next?
While being able to do these operations once is handy, it’s surely too much of a manual hassle to do this every time. An automation tool is somewhat incomplete unless it offers a record and play kind of capabilities. Thankfully, Appium does a great job of not only allowing you to create UI automation scripts but also being able to capture the code behind these scripts so that you can create a UI automation test suite for your project and run it when you want.
In the concluding part of this series, I will explain how we can use the above scripts to build Maven-based Java project for our UI automation suite with whatever we’ve done so far!
Stay tuned, it will be worth the wait!