1

I have a selenium webdriver live project build using maven and junit framework. I want to run this using jenkins. I google searched but was able to find information when the project is build using testng. I need this information for junit framework.

Any help will be highly appreciated.

Note: I am using eclipse mars, so maven is installed automatically.

4
  • Good question. I would like to know answer. Can you please tell what kind of approaches you have done?
    – Sagar007
    Commented Feb 23, 2016 at 5:26
  • Do you run your project with JAVA main class or with JUnit @Before?
    – Sagar007
    Commented Feb 23, 2016 at 5:29
  • I have built the automation using maven using JUnit fremework. Commented Feb 23, 2016 at 7:05
  • I have downloaded the jenkins war file from the jenkins website and ran it in command prompt using command java -jar jenkins.war. Rem: jenkins.war is the name of teh jenkins war. Now after the command got executed, you can run the url localhost:8080, you can find jenkins running. I am not sure how to run the project I have built in JUnit to run using jenkins Commented Feb 23, 2016 at 7:07

3 Answers 3

0

With Jenkins you can execute shell commands. I would just execute the Maven command you would use locally to run the tests on your own computer. Maybe something like: mvn clean test

Using Jenkins built-in "Execute Windows batch command" you can run commands using the windows shell.

Using Jenkins built-in "Execute shell" you can run commands using unix shell

1
  • Can please share more details or link ? Because I have maven project also.
    – Sagar007
    Commented Feb 23, 2016 at 5:25
0

I would suggest you follow the below approach

  • Create a main method to invoke your test
  • Use Maven for managing dependencies and create an Ant build file to run your main method
  • Install Ant plugin in Jenkins
  • Define workspace and build file while creating a Jenkin job. Specify time if you wish to run the test automatically at a given time/durations OR run the Jenkin job manually from Jenkins console

If you do not want to use Ant, you may create a jar file for your framework and run the jar directly by creating a Jenkins job that executes the jar file

0

I found below mentioned post to be highly useful to get my problem resolved

http://o7planning.org/web/fe/default/en/document/5189/install-maven-into-eclipse#a5303

This site gives step-by-step instructions for Eclipse 4.5 Mars/4.4 Luna, with lots of screenshots. Detailed instructions on installing as an embedded module or a standalone application and then configuring Eclipse to use Maven are given.

When I followed the instructions I was able to use the configuration I set up to get my Jenkins builds working.

1
  • It's great that you found an answer to your problem and posted it here, but could you please do two things to make this a good answer - first, edit your answer so it gives the important information from your link, then accept this answer. I will give you a starting point by editing your answer a little.
    – Kate Paulk
    Commented Jan 19, 2017 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.