Jenkins is one open source tool to perform continuous integration.
The basic functionality of Jenkins is to monitor a version control system and to start and monitor a build system (for example, Apache Ant or Maven) if changes occur.
Jenkins monitors the whole build process and provides reports and notifications to alert maintainers on success or errors.
Installation jenkins on Windows:
1)Download jenkins latest version from jenkins-ci.org" and store it in one place
2)Open the command prompt, go to jenkins.war file folder(where we stored)
3)Type java -jar jenkins.war in cmd prompt and press enter
4)Open new window/tab from browser and type localhost:8080
if we want to change port number java -jar pathof jenkins.war
--httpsPort=9090
Overview:definition:
Continuous integration is a process in which all development work is integrated at a predefined time or event and the resulting work is automatically tested and built. The idea
is that development errors are identified very early in the process.
Jenkins is one open source tool to perform continuous integration. The basic functionality of Jenkins is to monitor a version control system and to start and monitor a build
system (for example, Apache Ant or Maven) if changes occur. Jenkins monitors the whole build process and provides reports and notifications to alert maintainers on success or
errors.
Jenkins can be extended by additional plug-ins, e.g., for building and testing Android applications.
Creating Batch Files:
To create batch file we need to set classpath of testNG so that we can execute testng.xml files.
Executing tests from a .bat file is familiar or useful while using GRID. There are couple of ways to execute this.
1| Copy any one of the below methods in text file
2| Edit the drive location
3| Save it as yourtext.bat
4| Now, double click on the batch file created.
Note: Its better to execute from cmd prompt before try
Method #1:
cd C:\Workspace\projectname
java -cp C:\Workspace\projectname\lib\*;C:\Workspace\projectname\bin org.testng.TestNG testng.xml
Method #2:
cd C:\Workspace\projectname
set ProjectPath=C:\Workspace\projectname
echo %ProjectPath%
set classpath=%ProjectPath%\bin;%ProjectPath%\lib\*
echo %classpath%
java org.testng.TestNG %ProjectPath%\testng.xml
Example for job scheduling:
accepted
By setting the schedule period to 15 13 * * * you tell jenkins to schedule the build every day of every month of every year at the 15th minute of the 13th hour of the day.
What Jenkins used is a cron expression, the different fields are :
MINUTES Minutes in one hour (0-59)
HOURS Hours in one day (0-23)
DAYMONTH Day in a month (1-31)
MONTH Month in a year (1-12)
DAYWEEK Day of the week (0-7) where 0 and 7 are sunday
If you want to shedule your build every 5 minutes, this will do the job : */5 * * * *
f you want to shedule your build every day at 8h00, this will do the job : 0 8 * * *
Examples:
# start build daily at morning
03 09 * * 1-5
# start build daily at lunchtime
00 12 * * 1-5
# start build daily in the afternoon
00 14 * * 1-5
# start build daily in the late afternoon
00 16 * * 1-5
#start build at midnight
#@midnight
59 23 * * 1-5
Examples -
To schedule your build every 5 minutes, this will do the job : */5 * * * * OR H/5 * * * *
To the job every 5min past every hour(5th Minute of every Hour) 5 * * * *
To schedule your build every day at 8h00, this will do the job : 0 8 * * *
To schedule your build for 4, 6, 8, and 10 o'clock PM every day - 0 16,18,20,22 * * *
To schedule your build at 6:00PM and 1 AM every day - 0 1,18 * * *
To schedule your build start daily at morning - 03 09 * * 1-5
To schedule your build start daily at lunchtime - 00 12 * * 1-5
To schedule your build start daily in the afternoon - 00 14 * * 1-5
To schedule your build start daily in the late afternoon - 00 16 * * 1-5
To schedule your build start at midnight - 59 23 * * 1-5 OR @midnight
To run a job on 9.30p.m. (at night) on 3rd of May then I ll write or 21.30 on 3/5/2011 - 21 30 3 5 *
Every fifteen minutes (perhaps at :07, :22, :37, :52) 0 - H/15 * * * *
Every ten minutes in the first half of every hour (three times, perhaps at :04, :14, :24) - H(0-29)/10 * * * *
Once every two hours every weekday (perhaps at 10:38 AM, 12:38 PM, 2:38 PM, 4:38 PM) - H 9-16/2 * * 1-5
Once a day on the 1st and 15th of every month except December - H H 1,15 1-11 *
No comments:
Post a Comment