課程
/移動(dòng)開發(fā)
/Android
/Android UiAutomator 2.0 入門實(shí)戰(zhàn)
我想問下老師,最后一節(jié)課實(shí)戰(zhàn),用例編寫順序是加減乘除,為什么運(yùn)行自動(dòng)化的執(zhí)行順序是加除乘減
2018-05-09
源自:Android UiAutomator 2.0 入門實(shí)戰(zhàn) 4-1
正在回答
用例執(zhí)行默認(rèn)非順序的,注意這里使用的是JUnit4,參照J(rèn)Unit4用例執(zhí)行順序方法設(shè)置就可以實(shí)現(xiàn)想要的順序
JUnit是通過@FixMethodOrder注解(annotation)來控制測試方法的執(zhí)行順序的。
@FixMethodOrder
@RunWith(AndroidJUnit4.class) @FixMethodOrder(MethodSorters.JVM) public?class?DemoTest? 相關(guān)順序控制如下:
MethodSorters.JVM
Leaves the test methods in the order returned by the JVM. Note that the order from the JVM may vary from run to run (按照J(rèn)VM得到的方法順序,也就是代碼中定義的方法順序)
MethodSorters.DEFAULT(默認(rèn)的順序)
Sorts the test methods in a deterministic, but not predictable, order() (以確定但不可預(yù)期的順序執(zhí)行)
MethodSorters.NAME_ASCENDING
Sorts the test methods by the method name, in lexicographic order, with Method.toString() used as a tiebreaker (按方法名字母順序執(zhí)行)
舉報(bào)
零基礎(chǔ)學(xué)習(xí)UiAutomator 2.0自動(dòng)化測試,學(xué)會(huì)編寫 Android 自動(dòng)化測試用例
1 回答多條用例運(yùn)行出錯(cuò)
2 回答我mUidevice.pressKeyCode(KeyEvent.KEYCODE_BACK );執(zhí)行了,沒有報(bào)錯(cuò),但是虛擬機(jī)和手機(jī)都無法執(zhí)行動(dòng)作
2 回答問下 測試用例 寫完 后面呢? 怎么打包 怎么運(yùn)行
2 回答運(yùn)行測試用例報(bào)錯(cuò),android studio版本是2021.1.1
1 回答請問uiautomater中可以執(zhí)行adb命令嗎
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2018-05-11
用例執(zhí)行默認(rèn)非順序的,注意這里使用的是JUnit4,參照J(rèn)Unit4用例執(zhí)行順序方法設(shè)置就可以實(shí)現(xiàn)想要的順序
JUnit是通過
@FixMethodOrder
注解(annotation)來控制測試方法的執(zhí)行順序的。MethodSorters.JVM
MethodSorters.DEFAULT(默認(rèn)的順序)
MethodSorters.NAME_ASCENDING