我正在开发Android的UI Automator,以便在我当前的Project中自动执行少量测试用例。 到目前为止,我在com.myapp.testautomation包中编写的个别公共类包含的测试用例很少 从设备仪表板启动应用程序 新用户注册 登录 登出 如何立即运行所有这些案例并构建测试套件? 目前,我通过执行以下命令单独运行这些情况 adb shell uiautomator runtest PrjoectXYZ.jar -c com.myapp.testautomation.New User Registration adb shell uiautomator runtest PrjoectXYZ.jar -c com.myapp.testautomation.Login adb shell uiautomator runtest PrjoectXYZ.jar -c com.myapp.testautomation.Logout
答案 0 :(得分:0)
我发现运行多个测试用例的一种方法是执行一个shell脚本,其中包含测试用例。例如
ant build
adb push /Users/xyz/Documents/workspace/ProjectXYZ/bin/ProjectXYZ.jar /data/local/tmp/
adb shell uiautomator runtest PrjoectXYZ.jar -c com.myapp.testautomation.NewUserRegistration
adb shell uiautomator runtest PrjoectXYZ.jar -c com.myapp.testautomation.Login
adb shell uiautomator runtest PrjoectXYZ.jar -c com.myapp.testautomation.Logout
答案 1 :(得分:0)
如果你想从一个课程中运行所有测试,你可以这样做。 (根据user2040344的回答)
ant build
adb push /Users/xyz/Documents/workspace/ProjectXYZ/bin/ProjectXYZ.jar /data/local/tmp/
adb shell uiautomator runtest PrjoectXYZ.jar -c com.myapp.testautomation.testCases#NewUserRegistration
adb shell uiautomator runtest PrjoectXYZ.jar -c com.myapp.testautomation.testCases#Login
adb shell uiautomator runtest PrjoectXYZ.jar -c com.myapp.testautomation.testCases#Logout
注意testCases和NewUserRegistration之间有一个'#'。这表示您正在从同一个类调用方法,但只调用该方法。其他一切都是相同的,除了它允许你有一个控制所有测试用例的类,但你仍然可以单独使用它们。
答案 2 :(得分:0)
最简单的方法是创建一个.bat
文件。并将所有命令放入其中。做了很多次。这是最简单的方法,例如:
adb shell uiautomator runtest dialler.jar -c sprd.performance.dialler.Dialler
adb shell uiautomator runtest contactscroll.jar -c sprd.performance.contactscroll.ContactScroll
这是我要运行的两个脚本。为他们创建一个.bat
文件,然后双击.bat
文件。