天天看點

[android]android自動化測試三之設定AVD各項參數

有時候我們需要設定虛拟機的語言地區等,我們可以使用-prop參數,例如日本。 

the -prop command line option allows us to set any of the properties we could set: 

$ emulator -avd test -no-window -no-audio -no-boot-anim -port 5580 

-prop persist.sys.language=ja -prop persist.sys.country=jp & 

to verify that our settings were successful, we can use the getprop command to 

verify them, for example: 

$ adb –s emulator-5580 shell "getprop persist.sys.language" 

ja 

$ adb –s emulator-5580 shell "getprop persist.sys.country" 

jp 

if you want to clear all the user data after playing with the persistent settings, you 

can use the following command: 

$ adb -s emulator-5580 emu kill 

$ emulator -avd test -no-window -no-audio -no-boot-anim -port 5580\ 

-wipe-data 

and the emulator will start afresh. 

有的時候我們需要指定虛拟機需要用得網絡環境,網絡類型以及網速。 

option description speeds [kbits/s] 

-netspeed gsm gsm/csd up: 14.4, down: 14.4 

-netspeed hscsd hscsd up: 14.4, down: 43.2 

-netspeed gprs gprs up: 40.0, down: 80.0 

-netspeed edge edge/egprs up: 118.4, down: 236.8 

-netspeed umts umts/3g up: 128.0, down: 1920.0 

-netspeed hsdpa hsdpa up: 348.0, down: 14400.0 

-netspeed full no limit up: 0.0, down: 0.0 

-netspeed <num> select both upload and up: as specified, down: as 

                download speed specified 

-netspeed <up>:<down> select individual up and up: as specified, down: as 

                      down speed specified 

-netdelay gprs gprs min 150, max 550 

-netdelay edge edge/egprs min 80, max 400 

-netdelay umts umts/3g min 35, max 200 

-netdelay none no latency min 0, max 0 

-netdelay <num> select exact latency latency as specified 

-netdelay <min>:<max> select min and max latencies minimum and maximum 

                                                  latencies as specified 

this is an example of an emulator using these options to select the gsm network 

speed of 14.4 kbits/sec and a gprs latency of 150 to 500 msec. 

$ emulator -avd test -port 5580 -netspeed gsm -netdelay gprs