【问题标题】:ant build script for behat errorbehat错误的ant构建脚本
【发布时间】:2013-03-20 17:29:36
【问题描述】:

我正在尝试为 behat 测试设置一个 ant 构建脚本,以便我可以从 jenkins 运行它们。当我使用 bin/behat 或 ./bin/behat 从命令行运行 behat 时,输出按预期工作。但是当我使用以下 ant 脚本时

<project name="behat" basedir=".">
  <exec dir="bin" executable="./behat">
  </exec>
</project>

我收到此错误:

Buildfile: <mydir>/build.xml
 [exec]
 [exec]
 [exec]
 [exec]   [RuntimeException]
 [exec]   Context class not found.
 [exec]   Maybe you have provided wrong or no `bootstrap` path in your behat.yml:
 [exec]   http://docs.behat.org/guides/7.config.html#paths
 [exec]
 [exec]
 [exec]
 [exec] behat [--init] [-f|--format="..."] [--out="..."] [--lang="..."] [--[no-]ansi] [--[no-]time] [--[no-]paths] [--[no-]snippets] [--[no-]snippets-paths] [--[no-]multiline] [--[no-]expand] [--story-syntax] [-d|--definitions="..."] [--name="..."] [--tags="..."] [--cache="..."] [--strict] [--dry-run] [--rerun="..."] [--append-snippets] [--append-to="..."] [features]
 [exec]
 [exec]
 [exec] Result: 1

BUILD SUCCESSFUL
Total time: 0 seconds

【问题讨论】:

    标签: linux bash ant jenkins behat


    【解决方案1】:

    您不应该从 bin 目录运行 behat。它不会找到您的 behat.yml 文件。

    你应该像这样运行它:

    ./bin/behat
    

    或传递配置文件的路径:

    cd bin
    ./bin/behat --config ../behat.yml
    

    我没有尝试过后者。您的 ant 脚本可能类似于:

    <project name="behat" basedir=".">
      <exec dir="${basedir}" executable="./bin/behat" />
    </project>
    

    【讨论】:

      【解决方案2】:

      我把 ant 排除在外,直接用 jenkins 运行 behat 命令:

      cd <mydir>
      bin/behat
      

      我需要检查的一件事是 jenkins 的构建返回失败,但这可能是由于 behat 测试失败。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2010-11-12
        • 2011-03-06
        • 1970-01-01
        • 1970-01-01
        • 2015-06-10
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多