java - 移动自动化代码未运行并给出与诱惑相关的错误
问题描述
我是第一次使用 Appium 编写移动自动化测试脚本。我正在尝试运行安装在连接到计算机的 android 手机上的应用程序。我在 Eclipse 上用 Java 编写了代码。我的代码没有运行,我在控制台上看到以下消息:
[RemoteTestNG] detected TestNG version 6.9.10
[TestNG] Running:
N:\eclipse-workspace\TestPro\testng.xml
[main] ERROR io.qameta.allure.AllureLifecycle - Could not stop test container: container with uuid 67e81eee-0a3a-489a-9b83-5f5e3305f573 not found
[main] ERROR io.qameta.allure.AllureLifecycle - Could not write test container: container with uuid 67e81eee-0a3a-489a-9b83-5f5e3305f573 not found
===============================================
Suite
Total tests run: 0, Failures: 0, Skips: 0
===============================================
这就是我设置所需功能的方式 -
@BeforeClass
public void setup()
{
try
{
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "R8KN800EJ0J");
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "10");
caps.setCapability("appPackage", "com.jayway.contacts");
caps.setCapability("appActivity", "com.jayway.contacts.MainActivity");
caps.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 60);
caps.setCapability("fullReset", false);
caps.setCapability("noReset", true);
URL url = new URL("http://127/0/0/1:4723/wd/hub");
driver = new AppiumDriver<MobileElement>(url, caps);
}
catch(Exception exp)
{
System.out.println("Cause: " +exp.getCause());
System.out.println("Message: " +exp.getMessage());
exp.printStackTrace();
}
}
我尝试在我的pom.xml文件中添加 allure 依赖项,并在我的类文件中导入 allure 头文件,但我仍然遇到同样的错误。我不知道魅力是什么以及它是如何工作的,我还没有在我的代码中使用它,但仍然收到错误消息。
请帮忙。
解决方案
我找到了错误背后的原因。
- 我在 pom.xml 文件中的依赖项列表中使用了 allure 依赖项
- 我忘记在 testng.xml 文件中添加我打算运行的类
一旦我解决了上述问题,代码就成功运行了。
推荐阅读
- python - 访问 xarray DataArray 中的单个元素
- html - 设置 nativeElement.scrollTop 不起作用,滚动到 div 的底部
- php - 如何使用 codeigniter 进行日期之间的查询?
- rdf - 无法获取输出 (OWL) 文件中的所有值
- javascript - 如何使用 ytdl-core 通过 Discord.js 机器人发送下载的 .mp3?
- spring - 带有 Kotlin 的 Spring Boot - @Value 注释未按预期工作
- c# - 如何从 WindowsService 获取当前用户配置文件位置
- vue.js - Vue.js 处理尚未加载的数据
- firebase - Firebase 匿名身份验证商店 ID
- perl - 读取一个目录的所有文件或只读取一个文件