Appium Bootcamp – Chapter 4: Your First Test

Sauce AI for Test Authoring: Move from intent to executing in minutes.|xBack to ResourcesBlogPosted

April 26, 2026 · 6 min read · Tool Comparison

Sauce AI for Test Authoring: Move from intent to executing in minutes.

|

x

Back to Resources

Blog

Posted August 1, 2014

Appium Bootcamp – Chapter 4: Your First Test

quote

[UPDATE- November 2019] You can encounter the newest Get Started with Appium white papers here:Get Started with Appium- Java and Get Started with Appium- Ruby

This is the fourth post in a series called Appium Bootcamp by noted Selenium expertDave Haeffner

Dave recently plunge himself in the open source Appium project and collaborate with leading Appium contributor Matthew Edwards to bring us this material. Appium Bootcamp is for those who are brand new to peregrine examination automation with Appium. No familiarity with Selenium is ask, although it may be utile. This is the fourth of eight posts; two new situation will be release each week.

There are a full mickle of similarities between Selenium and Appium tests. We will be using similar action (likeclick) along with some kind of wait mechanics (e.g., anexpressed wait) to make our tryout more resilient. There will also be an asseveration used to determine if our actions be successful or not.

In order to put these conception to work, let & # x27; s regard the basic structure of the test apps we & # x27; ve be working with. They are straightforward in that they both have text elements that, when clicked, direct you to a dedicated page for that element (e.g., Accessibility activate the Accessibility page). Let & # x27; s step through our first set of tryout activity (in the console) that we & # x27; ll use to automatise this behavior; verifying that each element brings us to the correct page.

Let & # x27; s dig in with some example.

An iOS Example

The doings of our app can be easily mapped to test actions by 1st using a text lucifer to notice the element we want, and clicking it. We can then do sure we are in the right property by performing another text match (this time an accurate text match). When we wire this up to our test framework, this lucifer will be creditworthy for passing or failing the examination. More on that in the next post.

schoolbook (& # x27; Buttons, Various uses of UIButton & # x27;) .click
text_exact & # x27; Buttons & # x27;

The sole problem with this approach is that it is not resilient. The global wait for each test activity (a.k.a. an implicit wait) is set to 0 seconds by nonremittal. So if there is any delay in the app, the test action will not discharge and throw an ingredient not launch exception instead.

To overcome these timing problems we can apply an explicit wait around our examination action (both the click and the exact text match). This is simple enough to do with thewait command.

waiting {text (& # x27; Buttons, Various uses of UIButton & # x27;) .click}
wait {text_exact & # x27; Buttons & # x27;}

These test actions are resilient now, but they & # x27; re sturdy since we were using statically coded values. Let & # x27; s fix that by use dynamical values instead.

cell_1 = wait {text 2}
cell_title = cell_1.name.split (& # x27;, & # x27;) .first

wait {cell_1.click}
wait {text_exact cell_title}

Now we & # x27; re finding the first text by it & # x27; s index. Index2contains the first element (a.k.a. a cell), whereas power1is the table header. After that, we & # x27; re extracting the name and dynamically happen the title. Now our test will continue to act if there are any text changes.

This is good, but now let & # x27; s expand things to cover the rest of the app.

cell_names = rag (& # x27; UIATableCell & # x27;) .map {|cell| cell.name}

cell_names.each do |name|
wait {text_exact (name) .click}
wait {text_exact name.split (& # x27;, & # x27;) .first}
wait {rearward}
end

Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script.

We first catch the names of each clickable cell, storing them in a collection. We then iterate through the compendium, finding each factor by name, clicking it, performing an exact match on the resulting page, and then proceed rearward to the main blind. This is repeated until each cell is verified.

This act for cells that are off the screen (e.g., out of sight) since Appium will scroll them into view before taking an action against them.

An Android Example

Things are passably similar to the iOS example. We perform a text match, click action, and exact text match.

text (& # x27; Accessibility & # x27;) .click
text_exact & # x27; Accessibility Node Provider & # x27;

We so make thing resilient by wrapping them in an explicit wait.

wait {text (& # x27; Accessibility & # x27;) .click}
wait {text_exact & # x27; Accessibility Node Provider & # x27;}

We then make our selection more flexible by upgrading to dynamic value.

cell_1 = wait {text 2}

wait {cell_1.click}
waiting {find_exact & # x27; Accessibility Node Provider & # x27;}

We then expand things to exert the whole app by collecting all of the clickable elements and iterating through them.

cell_names = ticket (& # x27; android.widget.TextView & # x27;) .map {|cell| cell.name}

cell_names [1 .. -1] .each do |cell_name|
wait {scroll_to_exact (cell_name) .click}
wait_true {! exists {find_exact cell_name}}
wait {back}
wait {find_exact (& # x27; Accessibility & # x27;); find_exact (& # x27; Animation & # x27;)}
end

A few thing to note.

The first item in thecell_namescollection is a header. To toss it, we usecell_name [1 .. -1]which basically says start with the 2nd detail in the compendium (e.g.,[1) and uphold (e.g.,..) all the way until the end (e.g.,-1]).

In order to interact with cells that are off the blind, we will need to use thescroll_to_exactbidding, and perform aclickagainst that (instead of a text lucifer).

Since each sub-screen doesn & # x27; t have many unique attribute for us to verify against, we can at the very least verify that we & # x27; re no longer on the home screen. After that, we control that we are bring back to the habitation screen.

Outro

Now that we have our test action sussed out, we & # x27; re ready to charge them to code and punch them into a test runner.

About Dave Haeffner: Dave is a recent Appium convert and the author of Elemental Selenium (a free, once weekly Selenium tip newsletter that is read by yard of testing pro) as well as The Selenium Guidebook (a step-by-step guide on how to use Selenium Successfully). He is also the Jehovah and maintainer ofChemistryKit(an open-source Selenium framework). He has helped numerous companies successfully apply automate acceptance testing; include The Motley Fool, ManTech International, Sittercity, and Animoto. He is a beginner and co-organizer of theSelenium Hangoutand has spoken at numerous conferences and meetups about acceptance examination.

Continue the reading the former chapters:

Published:
Aug 1, 2014
Share this spot
Copy Share Link
LinkedIn
© 2026 Sauce Labs Inc., all rights allow. SAUCE and SAUCE LABS are registered stylemark owned by Sauce Labs Inc. in the United States, EU, and may be registered in early jurisdictions.
robot
quote

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free