如何在docker中使用硒网格配置jenkins?

问题描述

我正在尝试从本地网络中的远程服务器运行测试用例。 鉴于:

  1. 服务器操作系统:Ubuntu Server 20.04
  2. 已安装Docker
  3. Jenkins安装为容器
  4. 硒/集线器安装为容器
  5. 作为容器安装的硒/ node-chrome-debug
  6. 作为容器安装的硒/ node-firefox-debug
  7. 在Jenkins中以Freestyle Projects的身份创建新工作,添加GitHub存储库和凭据,构建触发器,执行外壳程序(mvn -Dtest = runners.UITestRunner verify -Dbrowser =“ chromeRemote”)

按“立即构建”时,我将其作为控制台输出

Started by user AutoSDET
Running as SYstem
Building in workspace /var/jenkins_home/workspace/AutoTest
The recommended git tool is: NONE
using credential 17d47c45-692c-4cec-bb04-776b05fe7894
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://github.com/autosdet/TestingProject.git # timeout=10
Fetching upstream changes from https://github.com/autosdet/TestingProject.git
 > git --version # timeout=10
 > git --version # 'git version 2.11.0'
using GIT_ASKPASS to set credentials 
 > git fetch --tags --progress -- https://github.com/autosdet/TestingProject.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision 1168d9888205432e1b1f30bdfe65c5958855f832 (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 1168d9888205432e1b1f30bdfe65c5958855f832 # timeout=10
Commit message: "Full upload"
 > git rev-list --no-walk 1168d9888205432e1b1f30bdfe65c5958855f832 # timeout=10
[AutoTest] $ /bin/sh -xe /tmp/jenkins6787831041590861507.sh
+ mvn -Dtest=runners.UITestRunner verify -Dbrowser=chromeRemote
/tmp/jenkins6787831041590861507.sh: 2: /tmp/jenkins6787831041590861507.sh: mvn: not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE

当我在IntelliJ终端中使用此命令(mvn -Dtest = runners.UITestRunner verify -Dbrowser =“ chromeRemote”)时,它可以正常工作。但是我需要从詹金斯那里运行测试用例。好像我错过了什么,但我不知道我错过了什么。谁能帮助我解决这个问题?

解决方法

您需要在詹金斯设置Maven 转到管理Jenkins->全局工具配置-> Maven enter image description here