Issue
I am trying to run my test cases from a remote server in my local network. Given:
- Server OS: Ubuntu Server 20.04
- Docker installed
- Jenkins installed as a container
- selenium/hub installed as a container
- selenium/node-chrome-debug installed as a container
- selenium/node-firefox-debug installed as a container
- Created new job in Jenkins as Freestyle Projects, add GitHub repository and credentials, build triggers, execute the shell (mvn -Dtest=runners.UITestRunner verify -Dbrowser="chromeRemote")
When press "Built Now", I get this as Console Output:
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
When I use this command (mvn -Dtest=runners.UITestRunner verify -Dbrowser="chromeRemote") in terminal of IntelliJ, it works fine. But I need to run test cases from Jenkins. Looks like I missed something, but I don't know what I missed. Can anyone help me with this problem?
Solution
You need to set Maven in Jenkins
Go to Manage Jenkins -> Global Tool Configuration -> Maven
Answered By - Alin Stelian
Answer Checked By - Mary Flores (JavaFixing Volunteer)