我有一系列使用selenium独立服务器运行的BDD selenium测试。要运行它们,我在终端中输入以下代码(一旦我在正确的目录中):
my-custom-class-name {
...
}
my-custom-class-name-content {
...
}
当测试完成时:
source project/bin/activate # Opens a virtualenv with appropriate interpreters
behave
我已经配置了一个Jenkins项目,该项目访问具有相同文件和测试的GitHub存储库。在项目中有一个执行shell命令的构建步骤。那里的代码是:
deactivate # Ends the virtualenv
但是,当我构建项目时,我得到以下输出:
#!/bin/bash
cd dev #Enter right directory
source project/bin/activate #Activate virtualenv
behave
我尝试过变化,似乎总能得到类似的结果。如何运行这些测试?
编辑:
我还尝试使用以下代码创建运行的shell脚本(run.sh):
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 git@github.com:<url>.git # timeout=10
Fetching upstream changes from git@github.com:<url>.git
> git --version # timeout=10
> git fetch --tags --progress git@github.com:<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
然后在Jenkins构建步骤中使用代码#!/bin/sh
exec project/bin/behave
代替./run.sh
或我在评论中提到的变体运行脚本,但是我得到了相同的错误。
答案 0 :(得分:1)