Monday, May 15, 2017

Jenkins - Adding a conditional build step.

In Jenkins, at times we may require Jenkins to execute some build step on one condition and another in case of other condition. For e.g: It may be required to run a particular test/batch command on Weekdays and some other batch condition on weekends. We can create a job to perform different tasks based on the condition satisfied. 

To add a conditional build step, follow below steps in Jenkins.

  • Navigate to Jenkins>Manage Jenkins>Manage Plugins and go to available tab.
  • Search for Conditional buildstep as shown below and click on install without restart.
  • It will install the plugin and will show success once installation completes.
  • Now the plugin can be used in the Jenkins job as shown below.In the job, add build step as Conditional step (single)

  • Provide the conditional step from the list as shown below and execute the build command.







Saturday, May 13, 2017

WaitFor Commands for AJAX application in selenium ide




AJAX stands for Asynchronous JavaScript And XML. AJAX uses combination of browser built-in XMLHttpRequest to request data from a web server and JavaScript/HTML DOM to display/use the data. Due to asynchronous nature of request and response of the calls, there may be delay in element being displayed in the page after an action has been performed on another element in the page.


To wait for the element to appear in the page, there are different waitfor commands in selenium IDE, which waits for default timeout set up for the element to appear. So in case an element is not displayed straightway, waitfor commands can be used to resolve sync issues in selenium IDE.


Some commonly used waitfor commands are:

  • waitForAlertNotPresent/waitForAlertPresent
  • waitForElementPresent
  • waitForTextPresent
  • waitForPageToLoad
  • waitForFrameToLoad
  • clickandWait
There are lot of commands waiting for different conditions in selenium IDE, you can have a look at all the commands by writing waitfor in command and can use the relevant wait as per the scernario

Saturday, May 6, 2017

Reload configuration from disk - Jenkins

In case of migration of existing jobs from one Jenkins setup to another setup or removing old build information from the disk, we can use the option to reload configuration from disk in Jenkins. Below are the steps to be be followed to reload configuration from disk:


  • When we set up jenkins in a machine, there is a folder with name .jenkins in location c:/users/<UserName> folder.

  • When we open the .jenkins>jobs folder, we see the folders for the jenkins jobs we have created in jenkins. 

  • We can copy folders from another jenkins instance and paste in this folder. Similarly we can make changes in the logs information or builds information.

  • Once we have made the required changes in the jenkins set up. Open Jenkins using localhost:8080 (assuming you are on the jenkins server itself and 8080 is the port used for jenkins and is installed as a window service on the server. Else if accessing from a remote client machine, use the address <machine name>:<port number>

  • The jenkins home Page will open as shown below.
  • Click on Manage Jenkins and in the Manage Jenkins Page, click on Reload configuration from disk as shown below. This will reload the changes made in jenkins set up.