代码之家  ›  专栏  ›  技术社区  ›  stampede76

behat错误的ant构建脚本

  •  0
  • stampede76  · 技术社区  · 13 年前

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

    <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
    
    2 回复  |  直到 13 年前
        1
  •  1
  •   Jakub Zalas    13 年前

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

    您应该这样运行它:

    ./bin/behat
    

    或传递到配置文件的路径:

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

    我没有试过后面的。你的蚂蚁脚本可能看起来像:

    <project name="behat" basedir=".">
      <exec dir="${basedir}" executable="./bin/behat" />
    </project>
    
        2
  •  0
  •   stampede76    13 年前

    我把ant从等式中去掉,只使用jenkins直接运行behat命令:

    cd <mydir>
    bin/behat
    

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

    推荐文章