Earn Money in 10 days

Selenium Videos

Protractor In Selenium

Livechat

Sunday, 2 November 2014

What is Continuous Integration/Jenkins/Selenium integration with Jenkins.


Continous Intgration is a Software Development Practice where members of the team integrate their work frequently usually each persion integrate daily leading to multiple integration per day..Each integration is verified by an automated build to detect integration errors as quicky as possible...
Why CI?

  1. Rapid FeedBack
  2. Reduced Risk
  3. Collective OwnerShip
  4. Continous Deployment
CI – What does it really mean? 
  •  At a regular frequency (ideally at every commit), the system integrated
  •  All changes up until that point are combined into the project 
  •  Built 
  •  The code is compiled into an executable or package 
  •  Tested 
  •  Automated test suites are run 
  •  Archived 
  •  Versioned and stored so it can be distributed as is, if desired 
  •  Deployed 
  •  Loaded onto a system where the developers can interact with it 
CI – Benefit
  •  Immediate bug detection 
  •  No integration step in the lifecycle 
  •  A deployable system at any given point 
  •  Record of evolution of the project 
Ques:Which is the most widely used continuous integration tool?
Ans:Jenkins...
Jenkins is an open-source continuous integration software tool written in the Java programming language.
Jenkins is a highly configurable system by itself.


This diagram will show you Jenkins process:
Jenkins - History 
 2005 - Hudson was first release by Kohsuke Kawaguchi of 
Sun Microsystems 
 2010 – Oracle bought Sun Microsystems 
 Due to a naming dispute, Hudson was renamed to Jenkins 
 Oracle continued development of Hudson (as a branch of the 

original) 
What is the Use of Jenkins in Selenium
Scenario:
Suppose your Boss or Team lead assigns you 200 testcase to execute in a day.So how you will do this.If your team lives  in different areas.One is in Banglore,Other is in Noida Third one is in Us.
By using Jenkins you can do this.
We will create our testcases and deploy on svn.(A Repository).What Jenkins will do?Jenkins will run those test case which are on repository.
Repository is a central hub where you all will store your Test case.
We can run our testcase using build.xml or Svn using BatchFile or Git
One of the most important feature of jenkins is 
Scheduling
We can schedule our build periodically.
Suppose you need to run build 1 at 10 am
Suppose you need to run a build2 at 2 Pm tomorrow.
Notifications:
It also provide email notification whether the test case is passed or failed.(Depends on the Configuration).
Step By Step Process to install and Configure Jenkins With your Script.
Step1.Go to Link

Step2:Keep This Jenkins.war File where your project is lying/Where you have workspace for Example:
C:Users\WorkSpace\ProjectName
Jenkins.War

                                              This is my Project Workspace
Step3:Open Command prompt and go till project home directory and append "Java -jar Jenkins.war and run it.



After adding java -jar jenkins.war.Run it.By pressing enter.

Now Jenkins is fully up.
Step4:Open your Browser and give localhost url :> http://localhost:8080


This is a Start up page.Now Click on Mange Jenkins.
Step5:Now click on Configure System

Step6:Now Set The jdk path.Uncheck the install automatically


Step7:Add the path of your jdk.Now click on Add jdk


Step8:Now Create a New Job.
To run your TestCase.We have to Create a New Job
Click on New Item



Add a name into ItemName
Click on radio Button of FreeStyleProject




Now Click on Advanced...

Step9:Now Add the Path of yourProject...In directory..
Note:EveryTime if you will create a new job you have to give the path of your project.



Step10:Click on Add build step:

Select Excecute Window BatchCommand:
Add BatFile into it..


How To Make BatFile
Step10:To Run Your TestCase/Job.First Create a Bat file into your ProjectDirectory




Note:
Command for Making Batfile:
java -cp bin;Jarfile/* org.testng.TestNG testng.xml
Jarfile is name of Jarfile which is in ProjectDirectory.
Jarfile should contain all the JarFile
Step11:Now next step is 
Open commandprompt and SetClassPath

set classpath=yourprojectpath\bin;YourProjectpathagain\Jarfile\*;



Step11:Now Go to Jenkins.Add run.bat 



After adding run.bat into it
Click on Save and Apply..
Step12:Now job is ready.You can run your TestCase..


 Click on Build Now
Note:You should have mention path in project directory..(Step9) is should be there.
This is the output of Test.If it is in blue  then Pass. if it is red then Fail.

How to Do Scheduling for TestCase.
Suppose you want to run your TestCase after every hour..



You can add any cron pattern for scheduling....
Refer to Wikipedia  for cron Pattern..
Linkk for cron pattern

5 comments:

  1. how to trigger our build on Jenkins automatically once the developer build is released ,manually we can trigger by clicking on Build now but is there any way to trigger automatically ( Periodical is exceptional)

    ReplyDelete
  2. how to work with git and git hub?
    please post a tutorial for it...

    ReplyDelete
  3. whats new in these blog..
    i)Can you please highlight with integration with build tools like maven...
    ii) More on Page Object and Page Factory

    ReplyDelete
    Replies
    1. Hi,

      Every person have different way to express idea and concept. Here Ritika as presented in her own style so whats new you are expecting here.

      Some more point on your question.

      1- Jenkins with maven- You can configure maven go to setting specify maven path and pom.xml and set goal


      2- For more about page object and page factory refer official documentation of POM

      https://code.google.com/p/selenium/wiki/PageObjects

      Delete
    2. i have read your article and thank u fir the screenshot point of explanation. how about the usage of Maven or ANT. will you tell the adv of using selenium through Hudson instead of jenkins. for hands on practice in selenium selenium training in chennai

      Delete

Popular Posts

 
subscribe
Subscribe Us
emailSubscribe to our mailing list to get the updates to your email inbox... We can't wait more to have your email in our subscribers email list. Just put your nice email in below box: