2013-03-20 114 views
0

我想安裝一個ant生成腳本behat測試,所以我可以從詹金斯運行它們。當我用bin/behat或./bin/behat命令行運行behat時,輸出按預期工作。但是,當我用下面的ant腳本螞蟻生成腳本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 

回答

1

您不應該從bin目錄運行behat。它不會找到你的behat.yml文件。

您應該像這樣運行:

./bin/behat 

或傳遞路徑配置文件:

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

我沒有嘗試過的版本。你的螞蟻腳本可能看起來像這樣:

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

工作。謝謝。 – steve76 2013-03-23 14:10:46

0

我把螞蟻的方程,只用於詹金斯運行貝哈特命令直接:

cd <mydir> 
bin/behat 

我需要檢查的一件事是從詹金斯返回失敗,但它可能是由於behat測試失敗。