简体   繁体   中英

Selenium With Jenkins- Continuous Integration and Deployment

I am new to Jenkins..!! I have automation scripts designed in Selenium as Maven Project. I am able to trigger the build (execute POM.XML from GIT repository) from Jenkins. My current Flow is as below. Eclipse -> GIT ->Jenkins (trigger POM.xml available in GIT). This approach is only for the test team wherein the push the selenium code changes to GIT branch and the code is tested by executing the POM.xml file.

I want to include the Deployment step (for DEV team) in this cycle. SO that the automation script executes on the latest deployment. So the flow should look something like below.

Eclipse (Dev code) -> GIT repo -> Jenkins (build) -> Jenkins (deployment in test environment) -> Jenkins (trigger POM.xml available in GIT)

This way I would be able to execute my POM.xml on every latest build.

Any help will be appreciated.

Jenkin has integration with Maven via Maven Plugin so

  1. If you're using a freestyle project just add the relevant build step in Jenkins GUI
  2. If you're using Jenkins Pipeline - declare your test execution via Pipeline Maven Plugin like:

     node{ stage ('Automation') { git url: 'https://path/to/your/test/repo' withMaven( maven: 'maven-3', mavenSettingsConfig: 'my-maven-settings') { sh "mvn clean test" } } } 
  3. Be aware that Jenkins might not have GUI therefore you may need to either use headless browsers versions or install extra software to simulate display like Xvfb

If you are a novice with Jenkins, start playing with it and download and install localy ( https://jenkins.io/download/ ).

It is not that much to it. Here are a few simple steps.

  1. install Jenkins, and probably have Maven, Java,
  2. setup path in Jenkins to Maven and Java in Global Tool Configuration section ins Jenkins settings,
  3. create a new Freestyle job,
  4. connect to git to the desired project on git, 在此处输入图片说明
  5. In section, build triggers add maven command like in console (without mvn) as "Invoke top-level Maven targets" with commands from maven like install, test etc. 在此处输入图片说明

Start job.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM