简体   繁体   中英

Java commands is not executing in appium

I am using an appium application for the past week. However, since the last two days it has not been working properly. My Java program is not getting executed in appium application. It was also not displaying any error messages when I run scripts. When I run the program, there is also no error messages in the console and nothing is happening in appium application as well.

I am using windows 7 and latest version of Eclipse and appium tools.

Code:

package sichernTest;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.BeforeMethod;

import io.appium.java_client.android.AndroidDriver;

public class SichernTestAuto {
    private WebDriver driver=null;

    @BeforeMethod
    @BeforeClass
    public void setUp() throws MalformedURLException{
        //Set up desired capabilities and pass the Android app-activity and app-package to Appium
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("automationName", "Appium");
        capabilities.setCapability("BROWSER_NAME", "Android");
        capabilities.setCapability("VERSION", "4.4.2"); 
        capabilities.setCapability("deviceName","Micromax");

       capabilities.setCapability("appPackage", "com.yelads.sichern.activity");
    // This package name of your app (you can get it from apk info app)
        capabilities.setCapability("appActivity","com.yelads.sichern.activity.Sichern"); // This is Launcher activity of your app (you can get it from apk info app)
    //Create RemoteWebDriver instance and connect to the Appium server
     //It will launch the Calculator App in Android Device using the configurations specified in Desired Capabilities
     driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);

    }


    @Test
    public void testCal() throws Exception {
WebElement signUp=driver.findElement(By.id("com.yelads.sichern.activity:id/signup_button"));
        signUp.click();
        driver.findElement(By.id("com.yelads.sichern.activity:id/email")).sendKeys("user@mail.com");
        driver.findElement(By.id("com.yelads.sichern.activity:id/confirm_email")).sendKeys("user@mail.com");
        driver.findElement(By.id("com.yelads.sichern.activity:id/msisdn")).sendKeys("9008515957");
        driver.findElement(By.id("com.yelads.sichern.activity:id/first_name")).sendKeys("Bharath L");
        driver.hideKeyboard();
}
}

This is what I'm getting in the Eclipse console:

[TestNG] Running:
  C:\Users\bharat\AppData\Local\Temp\testng-eclipse-1900899765\testng-customsuite.xml


===============================================
    Default test
    Tests run: 0, Failures: 0, Skips: 0
===============================================


===============================================
Default suite
Total tests run: 0, Failures: 0, Skips: 0
===============================================

[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 1 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@36300ca7: 29 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@102e6640: 8 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@48801b62: 87 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@37b335b7: 0 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@3bc51342: 15 ms

It always display these messages in eclipse console. Why is this so and how do I fix it?

You are using the JUnit @BeforeClass and @Test annotations.

import org.junit.BeforeClass;
import org.junit.Test;

And running the test through TestNG. Remove and add the wrong import statements.

Hope this will help. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM