How to run and test, test script in android and ios device

I am a devloper, i just run the script in android studio and testing, when my QA team want to run and test the script without studio, how it will be done, Please guide?

Unfortunatelly no one saw your code to help you.

public class FirstTest {

WebDriver driver;
public void setUp() throws MalformedURLException {
    // Created object of DesiredCapabilities class.
    DesiredCapabilities capabilities = new DesiredCapabilities();

    // Set android deviceName desired capability. Set your device name.
    capabilities.setCapability("deviceName", "SM-M20");

    // Set android VERSION desired capability. Set your mobile device's OS version.
    capabilities.setCapability(CapabilityType.VERSION, "10");

    // Set android platformName desired capability. It's Android in our case here.
   capabilities.setCapability(CapabilityType.PLATFORM_NAME, "Android");

    // Set android appPackage desired capability. It is
    capabilities.setCapability("appPackage", "com.example.sampleapplication");
    capabilities.setCapability("appWaitPackage", "com.example.sampleapplication");

    // Set android appActivity desired capability. It is
    capabilities.setCapability("appActivity", "com.example.myapplication.MainActivity");
    capabilities.setCapability("appWaitPackage", "com.example.myapplication.SplashActivity");

    capabilities.setCapability("fastReset", true);

    capabilities.setCapability("autoGrantPermissions", true);

    // Created object of RemoteWebDriver will all set capabilities.
    // Set appium server address and port number in URL string.
    // It will launch calculator app in android device.
    driver = new RemoteWebDriver(new URL(""), capabilities);
    driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);


public void testCase1() {
    System.out.println("Test Case 1");
   driver.findElement(By.xpath("//android.widget.EditText[contains(@resource-id, 'edit_text_1')]")).sendKeys("Test");
    String results=driver.findElement(By.xpath("//android.widget.EditText[contains(@resource-id, 'edit_text_1')]")).getText();
    driver.findElement(By.xpath("//android.widget.EditText[contains(@resource-id, 'edit_text_2')]")).sendKeys("Rani");
    assert results.equals("Test"):"Actual value is : "+results+" did not match with expected ";

public void End() {



This is the sample code, i tried… i have written this code in Android Studio, Java programming language…

how to test this same code in IOS…

Also confirm, IDE is compulsory to run test script and test in device, or any other alternate is there


so you use Junit.
what I will do on your place:

step 1: migrate project to Maven (or Gradle) to easier maintain.
step 2: make sure now you able to run tests from command line e.g. with maven and testNG:

mvn test -DsuiteName=suites/mySuite.xml

step 3: migrate to use page object with Appium annotation to have elements like:

@iOSXCUITFindBy(id = "ios_ID")
@AndroidFindBy(id = "android_ID")
private MobileElement myButton;

step 4: read for iOS

I have 4 screen,
i want to run the test script on screen 2,
but screen 1 is launcher activity,

in this case i tried appWaitpackage, i got error…

how to write test case and test?

In apk, how to run the test script for particular page?

Please guide

same as user. you start app -> you see one screen -> you tap on X button -> you go to needed screen

but my doubt is how to run the test script in this case?
how to run single page test script to test in apk, how the script will get invoke?

same as usual. e.g. example from our code:

                // Start adding invoice

Single script for all -> this in the case of hybrid app or it will suitable for Native(Android & IOS App) too

any sample tutorial available for this? if so, please share