【问题标题】:Cannot start JUnit tests using Appium in Eclipse无法在 Eclipse 中使用 Appium 启动 JUnit 测试
【发布时间】:2015-05-08 06:23:45
【问题描述】:

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

我的班级构建如下:

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();
}

【问题讨论】:

    标签: java ios eclipse junit appium


    【解决方案1】:

    确保您的以下库:

    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

    【讨论】:

    • 我已经导入了它,但仍然没有运气。可能还有其他想法吗?
    • 尝试将其作为 testng 运行
    • 不,它不起作用。我尝试以 testng 身份运行,仍然没有...还更改了@BeforeMethod,仍然没有结果。
    • 看看我更新的答案..我刚刚在我的电脑上测试过,它工作正常。
    • 好的,谢谢你,你帮了很多忙……我有一些导入与 junit 导入冲突,无法开始测试。我花了很多时间才观察到这一点。
    猜你喜欢
    • 2020-01-18
    • 1970-01-01
    • 1970-01-01
    • 2010-09-30
    • 1970-01-01
    • 2018-12-26
    • 2011-03-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多