David McDuff
David McDuff

Reputation: 234

How to setup jenkins to run Selenium / Maven / TestNG

I'd like to be able to run by Jenkins a series of test from Selenium. I've see a lot of topic about the subject but it's not clear to me.

Do I need to call maven to run the project or can I directly call Testng ?

Also do I need with Jenkins to call my project using maven or using Ant ?

What is the best practice. Is there specific plugin that I need.

Upvotes: 0

Views: 10409

Answers (2)

user7123229
user7123229

Reputation:

You can use run TestNG scripts in Jenkins with or without Maven. Maven as a build tool, in my opinion, looks more robust and gives you more flexibility than Ant.

To run pure TestNg script in Jenkins, enter the following in the 'build' section:

D:>java -cp "Pathtolibfolder\lib\*;Pathtobinfolder\bin" org.testng.TestNG testng.xml
  • Click on Save button.
  • Note: The actual path of lib and bin folder need to add the in above command.
  • After saving the command, Jenkins will build project in predefined time, and this command will run using TestNG.
  • The result will be stored in custom report HTML file that can be sent via email with a small Jenkins configuration

Upvotes: 0

Csaba Nagy
Csaba Nagy

Reputation: 11

Do I need to call maven to run the project or can I directly call Testng ?

You can call testng through maven or ant. There is no direct runner plugin for Jenkins.

What is the best practice. Is there specific plugin that I need.

You might need the TestNG plugin to show the results inside Jenkins, but it is optional. Best practice is to use maven or ant. You can find a nice ant example here

Upvotes: 1

Related Questions