2014-07-23 45 views
3

現在我們都知道,在iOS上運行測試的唯一方法是使用模擬器。我的問題是,我們正在運行jenkins,並且iOS版本正在從站上運行(通過SSH),因此運行xcodebuild無法啓動模擬器(因爲它無法運行)。我讀過的地方應該可以讓它與SimLauncher(gem sim_launcher)一起使用。但是我找不到有關如何使用xcodebuild進行設置的任何信息。任何指針都是受歡迎的。xcodebuild運行測試無頭?

回答

2

無頭和xcodebuild混合不好。請考慮以下替代方案:

您可以將從節點配置爲通過jnlp(webstart)啓動。我使用bash腳本與.command擴展作爲登錄項目(系統偏好設置 - >用戶 - >登錄項)具有以下內容:

#!/bin/bash 

slave_url="https://gardner.company.com/jenkins/jnlpJars/slave.jar" 

max_attempts=40 # ten minutes 
echo "Waiting to try again. curl returneed $rc" 
curl -fO "${slave_url}" >>slave.log 
rc=$? 
if [ $rc -ne 0 -a $max_attempts -gt 0 ]; then 
    echo "Waiting to try again. curl returneed $rc" 
    sleep 5 
    curl -fO "${slave_url}" >>slave.log 
    rc=$? 
    if [ $rc -eq 0 ]; then 
    zip -T slave.jar 
    rc=$? 
    fi 
    let max_attempts-=1 
fi 

# Simulator 
java -jar slave.jar -jnlpUrl https://gardner.company.com/jenkins/computer/buildmachine/slave-agent.jnlp -secret YOUR_SECRET_KEY 

構建用戶設置爲自動登錄。您可以通過執行看到參數給slave.jar應用:

gardner:~ buildmachine$ java -jar slave.jar --help 
"--help" is not a valid option 
java -jar slave.jar [options...] 
-auth user:pass     : If your Jenkins is security-enabled, specify 
            a valid user name and password. 
-connectTo HOST:PORT   : make a TCP connection to the given host and 
            port, then start communication. 
-cp (-classpath) PATH   : add the given classpath elements to the 
            system classloader. 
-jar-cache DIR     : Cache directory that stores jar files sent 
            from the master 
-jnlpCredentials USER:PASSWORD : HTTP BASIC AUTH header to pass in for making 
            HTTP requests. 
-jnlpUrl URL     : instead of talking to the master via 
            stdin/stdout, emulate a JNLP client by 
            making a TCP connection to the master. 
            Connection parameters are obtained by 
            parsing the JNLP file. 
-noReconnect     : Doesn't try to reconnect when a communication 
            fail, and exit instead 
-proxyCredentials USER:PASSWORD : HTTP BASIC AUTH header to pass in for making 
            HTTP authenticated proxy requests. 
-secret HEX_SECRET    : Slave connection secret to use instead of 
            -jnlpCredentials. 
-slaveLog FILE     : create local slave error log 
-tcp FILE      : instead of talking to the master via 
            stdin/stdout, listens to a random local 
            port, write that port number to the given 
            file, then wait for the master to connect to 
            that port. 
-text       : encode communication with the master with 
            base64. Useful for running slave over 8-bit 
            unsafe protocol like telnet 

gardner:~ buildmachine$ 

對於有關OSX奴隸的討論,以及如何掌握啓動,請參閱本詹金斯錯誤:https://issues.jenkins-ci.org/browse/JENKINS-21237

+0

嗨加德納,我會嘗試這種方法,當我有時間和批准,如果它的作品:) – Erik

+0

@Erik所以這個答案適合你嗎?我即將設置類似的東西。 – chakrit

+0

我們沒有得到這個工作,所以我們設置jenkins運行在Windows管理器 – Erik

2

埃裏克 - 我落得這樣做項目documented here

本質:

的第一個問題是,你必須有一個運行該版本也登錄到控制檯的Mac建立計算機的用戶。它需要能夠彈出模擬器,並且如果沒有用戶登錄就會失敗 - 因爲如果沒有顯示器就無法完全實現這一功能。其次,XCode Developer工具需要提升權限才能執行單元測試中的所有任務。有時你可能會錯過看到它,但如果沒有這些,模擬器會給你一個永不清除的驗證提示。

第一種解決方案,以本(上小牛)是運行:

sudo security authorizationdb write system.privilege.taskport allow 

這將消除一類這些認證彈出窗口。您還需要運行:

sudo DevToolsSecurity --enable 

每蘋果的人頁面上運行此工具:

在普通用戶的系統,第一次在一個給定的登錄會話 任何這樣的蘋果代碼 - 有簽名的調試器或性能分析工具是 用於檢查其中一個用戶的進程,將詢問用戶授權的管理員密碼爲 。 DevToolsSecurity工具改爲 更改授權策略,以使管理員組或_developer組成員 的用戶無需輸入 附加密碼即可使用Apple代碼簽名調試器或 性能分析工具。

唯一的問題是,一旦我升級到Xcode 6,這些相同的東西似乎被打破。回到繪圖板....

相關問題