【问题标题】:Automating frank from jenkins从詹金斯自动化弗兰克
【发布时间】:2012-12-07 16:49:24
【问题描述】:

我正在尝试使用 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 命令中手动键入最后一行,测试将被执行。

最好的问候

【问题讨论】:

  • 图你是在 Mac 上构建的。请注意,Jenkins 通常以自己的用户身份运行,这与您的用户不同。除非您以普通用户身份运行 Jenkins,否则这会导致很多问题。
  • 我会尽快看看,谢谢建议

标签: jenkins continuous-integration cucumber automated-tests frank


【解决方案1】:

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

这让我在从内部作业运行 cucumber 或启动 iOS 模拟器时感到非常头疼。

我终于学会了在自己的用户下启动 Jenkins,如下所示: "nohup java -jar /Applications/Jenkins/jenkins.war --httpPort=8080

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

【讨论】:

    【解决方案2】:

    每次您的应用程序崩溃时都会发生这种情况。当应用程序崩溃时,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 以错误结束时才会抓取日志)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多