Mobile automated testing using Appium and Java
Before we start, open this in a new tab and let the container load.
- 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 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.
💡 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
- Free Sauce account
- Make sure you know how to find your Sauce Labs Username and Access Key by going to the Sauce Labs user settings page
- We will run our automated tests on Sauce Labs devices; therefore, there is no need to install Appium Server.
- Please install appium inspector. Appium Inspector is basically just an Appium client (like WebdriverIO, Appium's Java client, etc...) with a user interface.
- The demo app that has been used for all these tests can be found here.
- 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 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.
- Sign up for a free GitHub account
- 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 🤩
- Click here
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
- Once the Gitpod.io URL is loaded, you will need to sign in with the GitHub account you created earlier
- 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] ------------------------------------------------------------------------
mobile_workshop_prep.mp4
✅👏Environment setup is complete if tests passed
- Sign up for a free GitHub account
- 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 🤩
- 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
Please leave quick and anonymous feedback on this workshop