2

我正在使用 Android 的 UI Automator 来自动化我当前项目中的几个测试用例。到目前为止,我编写的测试用例很少,例如 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

4

3 回答 3

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 之间有一个“#”。这表示您正在从同一个类调用一个方法,但只调用一个方法。除了它允许您拥有一个控制所有测试用例的类之外,其他一切都是相同的,但您仍然可以单独使用它们。

于 2013-10-21T17:26:04.657 回答
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
于 2013-06-01T17:54:08.433 回答
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文件。

于 2017-02-23T08:58:05.670 回答