Menu
AWS Device Farm
Developer Guide (API Version 2015-06-23)

Working with Appium Java JUnit for Web Applications and AWS Device Farm

Device Farm provides support for Appium Java JUnit for Web apps.

What Is Appium Java JUnit?

Appium is an open-source tool for automating native, mobile web, and hybrid applications on platforms such as Web applications. For more information, see About Appium.

Version Information

Currently, Device Farm supports Appium versions 1.6.3 and 1.4.16 and Java version Java 8.

Prepare Your Web Application Appium Java JUnit Tests

Your Web Application Appium Java JUnit tests must be contained in a .zip file.

Upload Your Web Application Appium Java JUnit Tests

Use the Device Farm console to upload your tests:

  1. Sign in to the Device Farm console at https://console.aws.amazon.com/devicefarm.

  2. If you see the AWS Device Farm console home page, choose Get started.

  3. If you already have a project, you can upload your tests to an existing project or choose Create a new project.

    
                Device Farm - Your Projects screen

    Tip

    If the list of projects is not displayed, then on the secondary navigation bar, for Projects, choose the name of the project where you want to upload your tests.

    To create a new project, follow the instructions in Create a Project.

  4. If the Create a new run button is displayed, then choose it.

  5. On the Choose your application page, choose Web application (the HTML5 button).

    
                Device Farm - Choose the Web application button

  6. Provide a name for your run in the Run name field.

    Tip

    Name the run something that helps you easily identify a specific build of your app (for example, Beta-0.1. For more information, see Working with Test Runs.

  7. Configure your test by choosing Appium Java JUnit.

  8. Next, choose Upload to upload your .zip file.

    Device Farm processes your .zip file before continuing.

  9. Choose the Appium version you are using from the Appium version dropdown list.

  10. Choose Next step, and then complete the remaining on-screen instructions to select devices and start the run.

Taking Screenshots in Web Application Appium Java Junit Tests

You can take screenshots as part of your Web Application Appium Java JUnit tests.

When Device Farm runs your Appium Java JUnit test, the service sets the following system properties that describe the configuration of the Appium server with which you're communicating:

  • appium.screenshots.dir: path to which the screenshots are saved

  • appium.server.address: host address of the Appium server

  • appium.server.port: port on which the Appium server is listening

Device Farm sets the SCREENSHOT_PATH property to a fully qualified path on the local file system where Device Farm expects Appium screenshots to be saved. The test-specific directory where the screenshots are stored is defined at runtime. The screenshots are automatically pulled into your Device Farm reports automatically. To view the screenshots, in the Device Farm console, choose the Screenshots section.

The following example shows how to use and consume the SCREENSHOT_PATH property to capture an Appium screenshot that is pulled into your Device Farm report.

Copy
public boolean takeScreenshot(final String name) { String screenshotDirectory = System.getProperty("appium.screenshots.dir", System.getProperty("java.io.tmpdir", "")); File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); return screenshot.renameTo(new File(screenshotDirectory, String.format("%s.png", name))); }

Additional Considerations for Web Application Appium Java JUnit Tests

Device Farm does not modify Web application Appium Java JUnit tests.