Saturday, June 17, 2017

How to execute only failed TestNG tests in Eclipse

While running testNG suite, once we are done with one round of execution of tests in the test suite, It can be helpful to execute only the failed tests during the first round of execution to reduce test failures due to flakiness/synchronization issues.

Below steps shows how to achieve this in eclipse.

  • Run the required test suite through eclipse as shown below.
testng eclipse run
  • Once the execution is completed and there are failures in the execution, we may require to rerun the tests.
  • Refresh the project. folder test-output should be displayed in the project explorer.
  • File testng-failed.xml should be available in the folder.
  • Run the test suite in similar manner as shown above, i.e Run As TestNG suite.

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