2011-09-08 127 views
0

我一直在试图让Selenium服务器运行一套现有的测试(在Selenium IDE中制作)在几个目标平台上运行。我正在使用批处理文件,因为我们想在每晚/每周的作业上运行测试。 我有以下几点:在Android上运行硒测试

@echo off 
cls 

echo Launching Selenium under Internet Explorer 
java -jar "c:\selenium\selenium-server-standalone-2.5.0.jar" -trustAllSSLCertificates -multiwindow -htmlSuite "*iehta" "http://mywebsite.com" "c:\selenium\tests\mytest.html" "c:\selenium\results\ie.html" 
echo completed.... 
echo --------------------------------------------------------------------------------- 

echo Launching Selenium under Firefox 
java -jar "c:\selenium\selenium-server-standalone-2.5.0.jar" -trustAllSSLCertificates -multiwindow -htmlSuite "*firefox" "http://mywebsite.com" "c:\selenium\tests\mytest.html" "c:\selenium\results\firefox.html" 
echo completed.... 
echo --------------------------------------------------------------------------------- 

echo Launching Selenium under Google Chrome 
java -jar "c:\selenium\selenium-server-standalone-2.5.0.jar" -trustAllSSLCertificates -multiwindow -htmlSuite "*googlechrome" "http://mywebsite.com" "c:\selenium\tests\mytest.html" "c:\selenium\results\chrome.html" 
echo completed.... 

echo --------------------------------------------------------------------------------- 
echo Launching Selenium under Opera 
java -jar "c:\selenium\selenium-server-standalone-2.5.0.jar" -trustAllSSLCertificates -multiwindow -htmlSuite "*opera" "http://mywebsite.com" "c:\selenium\tests\mytest.html" "c:\selenium\results\opera.html" 
echo completed.... 

echo --------------------------------------------------------------------------------- 
echo Launching Selenium under Android 
emulator -avd testdroid -no-boot-anim -scale .6 
echo Waiting for device to connect... 
adb wait-for-device 
adb devices 
echo Forwarding tcp port... 
adb -s emulator-5554 forward tcp:8080 tcp:8080 
echo Unlocking device... 
adb shell input keyevent 82 
echo Running Selenium... 
java -jar c:\selenium\selenium-server-standalone-2.5.0.jar -proxyInjectionMode -trustAllSSLCertificates -htmlSuite "*custom adb -s emulator-5554 shell am start -a android.intent.action.VIEW -d http://localhost:4444/wd/hub/ -n org.openqa.selenium.android.app/org.openqa.selenium.android.app.MainActivity" "http://mywebsite.com" "c:\selenium\tests\mytest.html" "c:\selenium\results\android.html" 
rem echo completed.... 
rem adb kill-server 

就被它去,似乎工作,但: IE是早早就锁定了在测试中,将最终给脚本/内存警告,但整个应用程序变得没有反应。

Android SDK确实启动了我的测试AVD,解锁并启动webdriver。但这就是它所做的一切。

所以我主要关心的是如何让Android webdriver开始运行测试。 如果任何人有IE浏览器的想法,这将是很好,但Android是真正的问题。

回答

1

最好的办法是将测试导出为简单的WebDriver测试(不使用WebDriverBackedSelenium)并使用AndroidDriver运行测试。

我们从来没有使用Selenium Core进行过测试,因此我怀疑它不能按预期工作。

1

对于桌面测试,它变成了服务器变更时的问题,尽管在同一个域中。 -disable-web-security并没有帮助,但客户要求Firfox运行应用程序测试和浏览器集合运行基于UI的测试不会穿越服务器是可以接受的。

即使通过Windows注册表加倍内存,IE9仍会耗尽内存,但我可能会改进一些测试来处理这个问题。

Android仍然顽固。