Appium-Eclipse-Maven:无需运行测试

时间:2015-03-25 14:27:16

标签: android eclipse maven automated-tests appium

我正在尝试用eclipse和maven运行一个非常简单的Appium-Test。但是我总是“没有试运行”-Message。

这是我的测试文件:

package MyPackage;

import java.net.MalformedURLException;
import java.net.URL;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;

public class AdviqoAppiumTest {

static AndroidDriver ad;

@Before
public  AppiumDriver setUp() {
//set up appium
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appium-version", "1.3.6");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "5.0.2");
capabilities.setCapability("deviceName", "htc-htc_one-FA396W907439");
capabilities.setCapability("udid", "192.168.168.88");
capabilities.setCapability("app",    "/Users/me/AndroidStudioProjects/myProject/project/build/outputs/apk/App-colored-beta.apk");
capabilities.setCapability("appPackage", "com.me.myProject.project");
capabilities.setCapability("appActivity", "com.me.myProject.project.ui.start.SplashScreen");

URL url=null;
try
{
    url = new URL("http://0.0.0.0:4723/wd/hub/status");
} 
catch (MalformedURLException e) {
    System.out.println("Error: " + e.getMessage());
    e.printStackTrace();
}
ad = new AndroidDriver(url,capabilities);
return ad;

}
@After
public void tearDown() throws Exception{
ad.quit();
}

@Test
public static void test(){

assertEquals(ad.currentActivity() ,".ui.start.SplashScreen");
ad.findElement(By.id("welcome_ok_btn")).click();
ad.closeApp();
}   
}

这是我的pom.xml:

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0     http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>AppiumTest</groupId>
<artifactId>AppiumTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>AppiumTest</name>
<prerequisites>
   <maven>2.2.1</maven>
 </prerequisites>
<dependencies>
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.0</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>LATEST</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>io.appium</groupId>
    <artifactId>java-client</artifactId>
    <version>2.1.0</version>
</dependency>
<dependency>
    <groupId>com.googlecode.json-simple</groupId>
    <artifactId>json-simple</artifactId>
    <version>1.1</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>commons-lang</groupId>
    <artifactId>commons-lang</artifactId>
    <version>2.6</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.2.4</version>
</dependency>
</dependencies>
<build>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
         <version>2.4.3</version>
    </plugin>
<plugin>
        <artifactId>maven-compiler-plugin</artifactId>
         <version>2.3</version>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>
    </plugin>
</plugins>
</build>

在终端 mvn -Dtest = MyPackage.AdviqoAppiumTest test

在终端停留几分钟后     [INFO]扫描项目......     [信息]     [INFO] ----------------------------------------------- ----------------- --------     [INFO]构建AppiumTest 0.0.1-SNAPSHOT     [INFO] ----------------------------------------------- -------------------------     [信息]     [INFO] --- maven-resources-plugin:2.6:资源(默认资源)@ AppiumTest ---     [警告]使用平台编码(实际上是UTF-8)来复制过滤后的资源,即构建依赖于平台!     [INFO]跳过不存在的resourceDirectory / Users / me / Documents / workspace / AppiumTest / src / test / java / src / main / resources     [信息]     [INFO] --- maven-compiler-plugin:2.3:编译(default-compile)@ AppiumTest ---     [INFO]无需编译的来源     [信息]     [INFO] --- maven-resources-plugin:2.6:testResources(default-testResources)@ AppiumTest ---     [警告]使用平台编码(实际上是UTF-8)来复制过滤后的资源,即构建依赖于平台!     [INFO]跳过不存在的resourceDirectory / Users / me / Documents / workspace / AppiumTest / src / test / java / src / test / resources     [信息]     [INFO] --- maven-compiler-plugin:2.3:testCompile(default-testCompile)@AppiumTest ---     [INFO]无需编译的来源     [信息]     [INFO] --- maven-surefire-plugin:2.4.3:测试(默认测试)@ AppiumTest ---     [INFO]没有测试可以运行。     [INFO] ----------------------------------------------- -------------------------     [信息]建立成功     [INFO] ----------------------------------------------- -------------------------     [INFO]总时间:1.918秒     [INFO]完成时间:2015年3月25日星期三15:07:09 CET 2015     [INFO]最终记忆:8M / 156M     [INFO] ----------------------------------------------- -------------------------

点击http://0.0.0.0:4723/wd/hub/status { “状态”:0 “值”:{ “建立”:{ “版本”: “1.3.6”, “修改”: “edcb7784cb3de1d6a3ca041f86cba8bc8b1f14f5”}}}

如果你需要别的东西,请问。 提前致谢。

0 个答案:

没有答案