Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

SeeTest extension for Appium extends the usual RemoteWebDriver API with additional 

methods.

For using this API add the appium-seetest-extension.jar into your project.

Once the jar is linked you can enhance your workflow by using one of the following classes included in the jar:

SeeTestCapabilityType, SeeTestServerCapabilityType - additional capabilities constants
SeeTestClient - additional methods for usage with appium studio

Table of Contents

Info

Appium SeeTest Extention supported only on a grid tests


1. Add to Project dependencies

Gradle 

Code Block
repositories {
	mavenCentral()
	maven {
		url "https://cloud.experitest.com/repo/"
	}
}
dependencies {
	//Appium - Junit specific
    compile group: 'junit', name: 'junit', version: '4.12'
    compile group: 'io.appium', name: 'java-client', version: '5.0.4'
    compile group: 'org.webjars.npm', name: 'css-in-js-utils', version: '2.0.0'
    compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
	compile group: 'com.experitest', name: 'appium-seetest-extension', version: '+'

}


2. Initialize

2.1. Standard Appium Driver Initialization

Code Block
languagejava
titleNormal Appium Driver Initialisation
linenumberstrue
AndroidDriver driver;
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability("user", "[username]");
dc.setCapability("password", "[password]");
....
driver = new AndroidDriver(new URL("https://[hostname.grid.server]:[port]/wd/hub"), dc);


2.2. SeeTest Extension Initialization

Code Block
languagejava
titleSeeTest Extension Initialisation
linenumberstrue
SeeTestClient seeTestClient = new SeeTestClient(driver);

3. List of commands that involve file uploads and downloads

When using files in a context of a grid server, the files aren't stored directly to the device as Appium Driver would do but stored on the server for future use.

As the file is uploaded, a file identifier is returned (fileToken in our examples).

Note
iconfalse
titleSecurity concerns

The file is session isolated and can't be used in other sessions or grid nodes.


When the session ends, the files are automatically deleted from the server.

Files operation are both supported by AdnroidDriver and IOSDriver.

3.1. Upload a file

Code Block
String fileToken = seeTestClient.uploadFile("C:\\dev\\img.jpg");

A file identifier is returned.

It can be then used for further Appium commands instead of using a local file path

3.2. Download file.

Code Block
seeTestClient.downloadFile(fileToken, fileToUploadPath);


The file will be downloaded in the location specified by the second parameter fileToUploadPath.

3.3. File related command supported in SeeTest Extension 

CommandSeeTest ExtensionLink



  • Report
Code Block
seeTestClient.report([Filepath of the image to attach to the report line.jpg]" , "my message 3", true);
  • startMonitor
  • getMonitorData
Code Block
seeTestClient.startMonitor("DemoTest");
seeTestClient.getMonitorsData("[Filepath where to store the monitorData.csv]");
  • collectSupportData
Code Block
seeTestClient.collectSupportData("[Filepath where to store the SupportData.zip]", null, null, null, null, null);
  • capture
Code Block
seeTestClient.capture("[Filepath where to store the screenshot.png]", "test line");
  • startLoggingDevice

  • stopLoggingDevice

Code Block
seeTestClient.startLoggingDevice("[Filepath to output file.txt]");
seeTestClient.stopLoggingDevice();
  • startAudioRecording

  • stopAudioRecording

Code Block
seeTestClient.startAudioRecording("[Filepath where to store the audio.wav]");
Thread.sleep(2000);
seeTestClient.stopAudioRecording();
  • simulateCapture
Code Block
seeTestClient.simulateCapture("[path to image to use for capture.png");
  • startAudioPlay

  • stopAudioPlay

  • waitForAudioPlayEnd
Code Block
seeTestClient.startAudioPlay("[Filepath to input audio.wav]");
seeTestClient.waitForAudioPlayEnd(10000)
seeTestClient.stopAudioPlay();

3.3. Unsupported commands

  • install(),
  • getDeviceLog(), generateReport()
  • startTransaction, endTransaction
  • startVideoRecord, stopVideoRecord
  • getMonitorsData() - without paramerter
  • capture() / capture(String line)

4. Example

Code Block
languagejava
themeEclipse
titleExample (Java)
collapsetrue
public class SeeTestClientExample {
    private AndroidDriver driver;
    private SeeTestClient client;

    @Before
    public void setUp() throws Exception {
        DesiredCapabilities dc = new DesiredCapabilities();
        dc.setCapability("app", EAndroidApps.ERI_BANK.absolutePath);
        driver = new AndroidDriver(new URL(SERVER_URL), dc);
		
		// Init the wrapper of driver
        client = new SeeTestClient(driver);
    }

    @After
    public void tearDown() throws Exception {
        if (driver != null) {
            driver.quit();
        }
    }

    @Test
    public void testMethodExists() throws Exception {
        // use the additional API method
        System.out.println(client.getDeviceLog());
	}
}