2017-05-17 3 views
1

私はセレンスタンドアロンサーバーを使用して実行する一連のBDDセレンテストを行っています。それらを実行するために、私は、端末(私が正しいディレクトリにいる一度)に次のコードを入力します。Jenkins Execute Shellのビルドステップから "振る舞い"テストをどのように起動させるのですか?

source project/bin/activate # Opens a virtualenv with appropriate interpreters 
behave 

とテストが行​​われたとき:

deactivate # Ends the virtualenv 

私はジェンキンスプロジェクトを設定しています同じファイルとテストでGitHubリポジトリにアクセスします。プロジェクトには、シェルコマンドを実行するビルドステップがあります。コードがあります:

Started by <user> 
Building in workspace /Users/Shared/Jenkins/Home/workspace/Tutorial 
> git rev-parse --is-inside-work-tree # timeout=10 
Fetching changes from the remote Git repository 
> git config remote.origin.url [email protected]:<url>.git # timeout=10 
Fetching upstream changes from [email protected]:<url>.git 
> git --version # timeout=10 
> git fetch --tags --progress [email protected]:<url>.git +refs/heads/*:refs/remotes/origin/* 
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10 
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 
Checking out Revision b62c3e873be4fba3daa1b29a9954a130c768a8f4 (refs/remotes/origin/master) 
> git config core.sparsecheckout # timeout=10 
> git checkout -f b62c3e873be4fba3daa1b29a9954a130c768a8f4 
> git rev-list b62c3e873be4fba3daa1b29a9954a130c768a8f4 # timeout=10 
[Tutorial] $ /bin/bash /Users/Shared/Jenkins/tmp/hudson719949293776127111.sh 
/Users/Shared/Jenkins/tmp/hudson719949293776127111.sh: line 4: behave: command not found 
Build step 'Execute shell' marked build as failure 
Finished: FAILURE 

私はバリエーションを試してきましたConsole Output

を参照してください。

#!/bin/bash 
cd dev      #Enter right directory 
source project/bin/activate #Activate virtualenv 
behave 

が、私は次の出力を取得し、プロジェクトをビルドするとき、しかし

Execute Shell Build stepを見ます常に同様の結果を得ているようです。これらのテストを実行するにはどうすればよいですか?

編集:

私も次のコードで振る舞う実行するシェルスクリプト(run.sh)を作成しようとしました:

#!/bin/sh 
exec project/bin/behave 

をして、ジェンキンスでスクリプトを実行するとしてステップを構築behaveの代わりにコード./run.shまたは私がコメントで言及したバリエーションが、私は同じエラーを取得します。

+0

ジョブでそれを呼び出すときに動作するフルパスを含めてみましたか? – Jacob

+0

@Jacob私は 'source project/bin/behave'というコードを試して、' command not found'というエラーメッセージを受け取りました。 'exec project/bin/behave'と' project/bin/behave'は 'No such file or directory'と' Undefined error:0'エラーを生成しますが、その動作はディレクトリにあります。あなたが気づいていないなら、私はすべてを試しているだけです。 –

答えて

0

私はついにそれを理解します。 Shining Pandaプラグインを使ってvirtualenvを作成し、ビルドステップでそれを有効にする必要がありました。プロジェクトをビルドするたびに新しいvirtualenvを作成しないために、新しいvirtualenvを作成した新しいジョブを作成しました。

enter image description here

その後、私は以前に作成したジョブで、シェルのステップを実行し、次のようになります:そのジョブのコンフィギュレーションビルドステップは次のようになります

enter image description here

どこ

/Users/Shared/Jenkins/Home/shiningpanda/jobs/ae39534a/virtualenvs/d41d8cd9/bin/activate

は、 virtualenvが作成されました。私は問題なく動作するように行動します。

関連する問題