Skip to content

A workshop about Mobile automated testing using Appium and Java

License

Notifications You must be signed in to change notification settings

eyaly/mobile-appium-java-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mobile testing w/ Appium + Java

Mobile automated testing using Appium and Java

Before we start, open this in a new tab and let the container load.

Try in Gitpod

🧠You will learn to

  • What is Appium
  • Create an automated Android test
  • Create an automated iOS test
  • Find element locators using Appium Inspector
  • Run tests in Sauce Labs real devices
  • Run tests in parallel

Testing for Good

🌎Testing for Good enables great test automation engineering while shaping a more equitable society.👩‍💻

Today, we're asking for donations for Environmental Working Group

We're advocates who won't quit. We're scientists that find solutions. We're people trying to make the safest choices for our health. At the Environmental Working Group, we believe that you should have easy access to the information you need to make smart, healthy choices. It’s this belief that inspired our president and co-founder, Ken Cook, to create EWG.

Since 1993, we've worked tirelessly to protect public health. Whether it's spotlighting harmful industry standards, speaking out against outdated government legislation or empowering consumers with breakthrough education and research, we're in this fight.

And we're not going anywhere.

👉 While the event is free, Sauce Labs encourages all attendees to

👉 donate

Anything helps!

100% of donations go to support the cause.

Key

💡 this is a tip

🏋️‍♀️ this is an exercise for you to do

❓ this is a question for us to think and talk about. Try not to scroll beyond this question before we discuss

Your Instructor: Eyal Yovel

me

  • 🏢 I’m a Sr Solutions Architect at Sauce Labs
  • 😄 Pronouns: he/him
  • 📫   Links:
    LinkedIn Twitter Github

Your TA:


Setup


Sauce Labs setup

  1. Free Sauce account
  2. Make sure you know how to find your Sauce Labs Username and Access Key by going to the Sauce Labs user settings page

Appium setup

  1. We will run our automated tests on Sauce Labs devices; therefore, there is no need to install Appium Server.
  2. Please install appium inspector. Appium Inspector is basically just an Appium client (like WebdriverIO, Appium's Java client, etc...) with a user interface.

Demo App(s)

  1. The demo app that has been used for all these tests can be found here.
  2. Be aware of the fact that and iOS simulator uses a different build then a iOS real device. So please check the file you download.

Gitpod setup

ℹ Gitpod lets you run an entire Dev environment from a browser! You can use this approach if you don't have time or you don't know how to setup a local Java environment.

  1. Sign up for a free GitHub account
  2. Fork this repository
  • Make sure you are logged into GitHub
  • Click the Fork in the upper right of the GitHub.
  • Give the repo a ⭐ while you're here 🤩
  1. Click here

Open in Gitpod

OR
In the browser address bar, add your GitHub url (https://github.com/USERNAME/this-repo-name) with https://gitpod.io/# * The resulting url should look as follows:

  > https://gitpod.io/#https://github.com/USERNAME/mobile-appium-java-workshop
  1. Once the Gitpod.io URL is loaded, you will need to sign in with the GitHub account you created earlier
  2. Once the development environment is loaded, you should see 'Ready to test!' in the Terminal window in the lower portion of the window, run the following commands in that Terminal to set your SAUCE_USERNAME, SAUCE_ACCESS_KEY:
eval $(gp env -e SAUCE_USERNAME=<sauce_username>)
eval $(gp env -e SAUCE_ACCESS_KEY=<sauce_access_key>)

Replace <sauce_username>, <sauce_access_key> with your credentials

Once you have run those 2 commands, you can run the following commands to test your environment variables:

echo $SAUCE_USERNAME
echo $SAUCE_ACCESS_KEY

Run sanity tests

mvn clean test -DtestngXmlFile=myDemoTests.xml

Click here to see an example console output.
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
*** BeforeMethod hook. Running method demoTest ***
region is us
*** Start demoTest test ***
*** AfterMethod hook ***
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.488 s - in TestSuite
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.579 s
[INFO] Finished at: 2022-07-04T12:05:35+01:00
[INFO] ------------------------------------------------------------------------

In the next video I demo how to fork the repo and connect to Gitpod:

mobile_workshop_prep.mp4

✅👏Environment setup is complete if tests passed


Local environment setup

  1. Sign up for a free GitHub account
  2. Fork this repository
  • Make sure you are logged into GitHub
  • Click the Fork in the upper right of the GitHub.
  • Give the repo a ⭐ while you're here 🤩
  1. Clone your fork of the repository to your machine. Must have Git installed
git clone URL_OF_YOUR_FORK

Setup environment variables on your system

Run sanity tests

mvn clean test -DtestngXmlFile=myDemoTests.xml

Click here to see an example console output.
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
*** BeforeMethod hook. Running method demoTest ***
region is us
*** Start demoTest test ***
*** AfterMethod hook ***
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.488 s - in TestSuite
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.579 s
[INFO] Finished at: 2022-07-04T12:05:35+01:00
[INFO] ------------------------------------------------------------------------

✅👏Environment setup is complete if tests passed

Extra resources

Conclusions

Please leave quick and anonymous feedback on this workshop

About

A workshop about Mobile automated testing using Appium and Java

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages