Appium tests written in Java

Appium tests written in Java are detected by looking for a Maven pom.xml build file that has the Appium dependency declared in it.

Android

Specify the location of your .apk that's going to be tested, this should be the relative path from the test file to the .apk as in the following example:

File classpathRoot = new File(System.getProperty("user.dir"));
File appPath = new File(classpathRoot, "../../App/build/outputs/apk/App-gh-android-debug.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
...
capabilities.setCapability("app", appPath);

iOS

Specify the location of your .app directory that's going to be tested, for this we export an environment variable called NEVERCODE_SYMROOT. This will hold the path of the current build's SYMROOT. Your tests should use this variable as in the following example:

String appPath = System.getenv("NEVERCODE_SYMROOT");
File appDir = new File(appPath, "Debug-iphonesimulator");
File app = new File(appDir, "greenhouse-ios.app");
DesiredCapabilities capabilities = new DesiredCapabilities();
...
capabilities.setCapability("app", app.getAbsolutePath());

Example

Example test projects are available for both Android and iOS.

Updated 3 years ago

Appium tests written in Java


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.