2012-10-17 70 views
1

我在Jenkins的「Execute shell」命令中添加了perl腳本。這個perl腳本通過命令行啓動儀器,運行js測試(我們使用tuneup_js框架)。當腳本統計其中一個測試時,jenkins控制檯輸出與輸出的儀器完全不同。參見下面由詹金斯控制檯給出的輸出:通過Jenkins運行UI自動化

Oct 17 15:06:03 macserver.local instruments[7197] <Error>: CGImageCreateWithImageProvider: invalid image size: 0 x 0. 
2012-10-17 15:08:10.312 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0x7c41ab0 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940> 
2012-10-17 15:08:10.316 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0xaa28be0 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940> 
2012-10-17 15:08:10.320 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0xaa2a5d0 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940> 
2012-10-17 15:08:10.324 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0xa4274e0 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940> 
2012-10-17 15:08:10.328 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0x7c433a0 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940> 
2012-10-17 15:08:10.332 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0x7c43c50 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940> 
2012-10-17 15:08:10.335 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0x7c44d90 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940> 
2012-10-17 15:08:10.339 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0x7c43340 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940> 
2012-10-17 15:08:10.343 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0x7c45ab0 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940> 

我可以看到在模擬器上完美運行測試。如果我運行通過儀器相同的測試我的輸出看起來是這樣的:

2012-10-17 21:10:32 +0000 Start: 
2012-10-17 21:10:32 +0000 Pass: 
2012-10-17 21:10:32 +0000 Start: 
2012-10-17 21:10:32 +0000 Issue: 
2012-10-17 21:10:32 +0000 Issue: 
2012-10-17 21:10:32 +0000 Pass: 
2012-10-17 21:10:32 +0000 Start: 
2012-10-17 21:10:32 +0000 Debug: target.setDeviceOrientation("3") 
2012-10-17 21:10:33 +0000 Issue: 
2012-10-17 21:10:33 +0000 Debug: target.setDeviceOrientation("1") 
2012-10-17 21:10:35 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0].buttons()["t"].tap() 
2012-10-17 21:10:36 +0000 Debug: target.setDeviceOrientation("3") 
2012-10-17 21:10:38 +0000 Issue: 

我想類似上面的控制檯輸出的東西輸出。這可能嗎?

回答

0

我終於搞定了!

問題在於運行測試的perl腳本。

而不是使用系統($命令),我使用的是返回標記運算符。

我不知道爲什麼反引號操作符不會返回輸出,也不知道爲什麼system()在這裏工作。

+0

可能是stdout和stderr之間的區別? – Richard