2

我正在尝试使用 Frank 自动化 jenkins 的测试会话。

这是我收到的错误消息。

  (Frank::Cucumber::FrankNetworkError)
  ./step_definitions/test_steps.rb:30:in `/^I navigate to button V\303\244der$/'
  test.feature:41:in `When I navigate to <link>'
  | Radar       | Norrland    |


  *********************************************
  Oh dear. Your app fell over and can't get up.
  *********************************************

Jenkins 从 git 中检查代码,除此之外我还添加了一个 shell 命令,如下所示。

cd ios    #<--this is so that I go to the root folder, the one with the .xcodeproj project
frank setup
frank build
frank launch
mv features/*.feature Frank/features/.  #<--- this is the testscript
mv features/step_definitions/*.rb Frank/features/step_definitions/.   #<--here it is moved to the newly created frank/features & Frank/features/step_definitions folder
cd Frank/features
cucumber test.feature 

一切都是按照它应该的方式构建的,如果我去服务器
并从我的 shell 命令中手动输入最后一行,测试就会被执行。

此致

4

2 回答 2

0

每次您的应用程序崩溃时都会发生这种情况。当应用程序崩溃时,frank 停止接收事件,并且 cucumber 以您看到的错误结束。

有两个可能的原因:

  1. 您的应用程序中存在导致应用程序崩溃的错误
  2. Frank 有一个错误导致您的应用崩溃

您应该检查崩溃/应用程序日志以查看确切原因。

我了解到这对于通过 jenkins 作业捕获应用程序日志非常有帮助,例如

function grab_log_and_fail {
    APP_NAME = "MyApplication"

    # get the PID of the last process with the given name
    PID=$( cat /var/log/system.log | grep "$APP_NAME\[" | tail -n 1 | sed -e "s/^.*$APP_NAME\   [\([^\]*\)\].*/\1/g" )

    # grab all the messages from the process with the PID
    cat /var/log/system.log | grep "$APP_NAME\[$PID\]" >"$WORKSPACE/$APP_NAME.log"

    #fail the job
    exit 1
}

您可以使用它来调用它

cucumber test.feature || grab_log_and_fail

(仅当 cucumber 以错误结束时才会获取日志)

于 2013-05-02T16:21:45.747 回答
0

我个人在 Mac 上运行 Jenkins 时遇到了很多问题。特别是如果您使用 Jenskins Mac 映像安装程序,Jenkins 总是在安装期间创建的“jenkins”用户下运行。

这让我很头疼从内部作业运行黄瓜或启动 iOS 模拟器。

我终于学会了在我自己的用户下启动 Jenkins,像这样:“nohup java -jar /Applications/Jenkins/jenkins.war --httpPort=8080

从那时起,我就可以毫无问题地运行黄瓜了。希望这可以帮助。

于 2013-04-21T12:28:24.423 回答