linux - 用于 behat 错误的 ant 构建脚本

标签 linux bash ant jenkins behat

我正在尝试为 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

最佳答案

您不应该从 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>

关于linux - 用于 behat 错误的 ant 构建脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15530644/

相关文章:

php - Virtual Box 中的访问被拒绝

linux - 什么是 "useradd -r -d/opt/otrs/-c ' OTRS 用户的 otrs"和 "usermod -G nogroup otrs www-data"的 OS X

java - 使用 Ant 运行 JUnit 批处理文件时出现 "Unable to write log file"错误

linux - 用于更改不同扩展名的文件名的 Bash 脚本

适用于 Windows 的 Python 程序可执行文件

c - 扫描调用进程的内存

bash - 在特定文本后将文本插入文件

bash - 在 Ubuntu 中重新创建 PyCharm 启动器

java - 在默认包中构建(使用 ant)一个 jar,它是主要的

java - 使用 resourcecount 获取属性中的行数