: enter image description here실행 testng.xml 항상 반환 "전체 검사 실행 : 0"
을 전에서 testng.xml를 실행하는 경우를 일식 (ProjectName-> testng.xml-> rightClick-은> 실행 된 직후> TestNG의 스위트는) 모든 작품을 좋아 : enter image description here 을 클래스에서 코드입니다 :`
package TestNGZ;
import io.appium.java_client.android.AndroidDriver;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.annotations.Test;
public class ClassOne {
AndroidDriver dr;
@Test
public void call() throws MalformedURLException{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "Nexus5");
capabilities.setCapability("platformVersion", "6.0");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("appPackage", "com.age.wgg.appspot");
capabilities.setCapability("appActivity", "com.age.wgg.appspot.Main");
dr = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
@Test
public void login() throws InterruptedException {
String buttonCheckLogIn = "Settings";
WebDriverWait wait = new WebDriverWait(dr,30);
//Implicit Wait
// dr.manage().timeouts().implicitlyWait(1,TimeUnit.SECONDS);
//Explicit Wait
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//android.widget.Button[5]")));
//Tap on FB Login
dr.findElement(By.xpath("//android.widget.Button[5]")).click();
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//android.widget.EditText[1]")));
//Insert Username
dr.findElement(By.xpath("//android.widget.EditText[1]")).click();
dr.getKeyboard().sendKeys("[email protected]");
//Insert Password
dr.findElement(By.xpath("//android.widget.EditText[2]")).click();
dr.getKeyboard().sendKeys("Gameloft2013");
//Tap on Log In button
dr.findElementByAccessibilityId("Log In ").click();
//Explicit Wait
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//android.view.View")));
//Tap OK in Confirmation Prompt
dr.findElementByAccessibilityId("OK ").click();
//Explicit Wait
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//android.widget.Button[5]")));
//Verification if the Login was successfully or not
if (dr.findElement(By.xpath("//android.widget.Button[5]")).getText().equals(buttonCheckLogIn)) {
System.out.println("Log In ===> Success");
} else {
System.out.println("Log In ===> Failed");
}
}
@Test
public void logout() throws InterruptedException {
String buttonCheckLogOut = "Log in";
//Verifying FB Log out functionality
dr.findElement(By.xpath("//android.widget.Button[5]")).click();
dr.findElement(By.name("Logout")).click();
dr.findElement(By.name("YES")).click();
Assert.assertTrue(dr.findElement(By.xpath("//android.widget.Button[5]")).getText().equals(buttonCheckLogOut));
//Verification if the Log out was successfully or not
if (dr.findElement(By.xpath("//android.widget.Button[5]")).getText().equals(buttonCheckLogOut)) {
System.out.println("Log Out ===> Success");
} else {
System.out.println("Log Out ===> Failed");
}
//Kill Session
dr.quit();
}
}`
는 명령 줄에서 나는 다음과 같은 명령을 실행 :
java -cp "C:\Users\Ionut B\Downloads\eclipse-java-kepler-SR1-win32-x86_64\eclipse\plugins\org.testng.eclipse_6.11.0.201703011520\lib\*;C:\Users\Ionut B\workspace\TestZero\bin" org.testng.TestNG testng.xml
Appium 서버가 실행 중이고 에뮬레이터가 켜져 있습니다. 나는 모든 것을 조사했지만 이것에 대한 해결책을 찾지 못했고 여기서 누군가가 나를 도울 수 있습니다. 감사합니다. .