无法在Eclipse中使用Appium启动JUnit测试

时间:2015-03-06 15:43:13

标签: java ios eclipse junit appium

我想使用Eclipse和appium启动JUnit测试。当我右键单击并选择run as时,在项目中我选择我的项目,但是在测试中没有显示任何内容。任何想法我哪里出错?

我的课程构建如下:

public WebDriver driver = null;

@BeforeMethod
public void setUp() throws Exception {
  // set up appium
  DesiredCapabilities capabilities = new DesiredCapabilities();
  capabilities.setCapability(CapabilityType.BROWSER_NAME, "iOS");
  capabilities.setCapability(CapabilityType.VERSION, "6.1");
  capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
  capabilities.setCapability("app", "the path to the simulator app is correct, tested it with other software");
  driver = new RemoteWebDriver(new URL("http://127.0.0.1:4725/wd/hub"), capabilities);
}

@Test
public void test01() throws InterruptedException {

  Thread.sleep(5000);

}

@AfterMethod
public void tearDown() throws Exception {
  driver.quit();
}

1 个答案:

答案 0 :(得分:0)

确保以下库:

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

另外,尝试将@BeforeMethod和@AfterMethod更改为@ BeforeTest / @ AfterTest