简体   繁体   中英

Selenium test execution via jenkins on linux box

How to run selenium webdriver scripts via jenkins on linux machine and publish the test results in Jenkins?

I am using Jenkins as my Continuous integration tool. Jenkins is running in linux machine. I need to run the Selenium test suite during build process in jenkins and publish the results back in jenkins.

I was able to run all the junit/testng test cases during build process and able to publish the results in jenkins except the selenium scripts.

Can anyone suggest how to run selenium in linux box ?

Basically to run selenium scripts via any CI tool needs to have build tool like ANT, MAVEN etc or any other tool which allows you to run selenium scripts using command line. Jenkins provides options to run shell scripts, windows batch commands, ant targets etc so If you can run tests via any one of above the ways then you can easily configure a job in Jenkins which will run the tests.

An overview to run selenium tests in Jenkins:

  1. Locate your code pool in Jenkins Job. You can either use your local codebase or any version control system.

  2. As Jenkins provides options to run any command which can get executed from command line so you have to setup your selenium tests in such way that it can get executed from command line. I'd suggest to use ANT for that. If you use ANT to run the tests then you can specify your build.xml path and ANT target in Jenkins and it will run that target for you.

  3. Jenkins provides you option to publish HTML/Junit reports, so you just need to locate the path of report where it gets generated after test execution. Jenkins will publish those report for you.

As you said Jenkins setup exist on linux box, so you need to make your tests compatible to linux machine. You have to instantiate drivers considering linux machine or you can setup a Jenkins windows slave which will allow you to run tests on windows machine.

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