Site icon TestingDocs.com

Run Automated Appium Test on Kobiton Cloud

Introduction

Kobiton is a mobile cloud testing platform that enables testers to perform manual & automated testing of mobile applications. The platform supports iOS and Android real devices. Let’s write a simple Appium test and run the test on the Kobiton cloud platform.

Official Website: https://kobiton.com/

 

Free trial

The service offers 15 days free trial to test the platform. Free users can utilize a limited set of shared cloud devices. Cloud devices for both the iOS and Android platforms are available.

 

Automated Appium Test

Let’s write a simple automated Appium test and run on the iOS device. The test launches the www.TestingDocs.com website on the iOS mobile device and verified the website title.

package com.testingdocs.appium.quickstart.AppiumProject;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import io.appium.java_client.android.AndroidDriver;

/**
 * Cloud Test.
 */
public class AppTest{
  public static final String USERNAME = "<Kobiton_Username>";
  public static final String ACCESS_KEY = "<Kobiton_API_AccessKey>";
  public static final String URL = "https://"+USERNAME+":" + ACCESS_KEY + 
"@api.kobiton.com/wd/hub";
  public static AndroidDriver<?> mDriver;

  @BeforeTest
  public void beforeTest( ) throws MalformedURLException {
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("sessionName", "Automation test session");
    capabilities.setCapability("sessionDescription", "");
    capabilities.setCapability("deviceOrientation", "portrait");
    capabilities.setCapability("captureScreenshots", true);
    capabilities.setCapability("browserName", "safari");
    capabilities.setCapability("deviceGroup", "KOBITON");
    capabilities.setCapability("deviceName", "iPhone 8");
    capabilities.setCapability("platformVersion", "13.4.1");
    capabilities.setCapability("platformName", "iOS");
    mDriver = new AndroidDriver<>(new URL(URL), capabilities);
  }

  @AfterTest
  public void afterTest( ){
    mDriver.quit();
  }

  @Test
  public static void launchBrowser(){
    mDriver.get("https://www.testingdocs.com/");
    Assert.assertEquals(mDriver.getTitle(), "Home | TestingDocs", "Check Title");
  }
}

Test Result

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 99.746 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:45 min

Verify the Cloud session

 

 

Appium Tutorials:
https://www.testingdocs.com/appium-tutorials/

For more information on Appium Tool:
http://appium.io/

Exit mobile version