Running simple Ant builds via Jenkins

I assume that a Jenkins is already installed and running on your system.
the first step is to open Jenkins in your web browser a If you didn’t changed the default settings you can reach Jenkins on http://localhost:8080/

After you login to Jenkins the following screen should appear:

Set up ant in Jenkins in Manage Jenkins -> Configure System. If you use auto install Jenkins will download Ant immediately before the next build.

Sending notification for broken builds via gmail account in Jenkins

To be able to send emails in Jenkins we have to do two things:
Setup SMTP server in global settings and set the notification option in the project.

    To set SMTP server:

  • go to Manage Jenkins -> Global Settings
  • SMTP server (i.e., outgoing mail):
  • SMTP username: Your full Gmail or Google Apps email address (e.g. or
  • SMTP password: Your Gmail or Google Apps email password – be aware if you have a 2-Step Verification, you have to generate a code for the setup
  • SMTP port: 465
  • SMTP TLS/SSL required: yes


Jenkins setup and basic security settings

You have to download a platform-specific installer from Jenkins site:

The installation should be easy, if you have any issues with it you can find additional information on the site

After the installation in windows you should restart your machine, Jenkins will start up with windows.
To check if it running you have to go to http://localhost:8080/

My advice is that the first thing should be to set up an administrator account to block people from the network to misuse the application.

Change iOS Settings on virtual device with Appium

In our previous post we introduced the steps to set up your Appium environment for iOS 9 devices. In this post we will write about how can you open the Settings app and do some changes in it. We will use Java as programming language, Eclipse for IDE and JUnit as runner.

Ok, so first step is to get the Java client of Selenium from Extract the downloaded *.zip file, create a new Java Project in Eclipse and add all extracted *.jar files to Build Path. Now, we can start to implement our first test case for iOS device where we will open the Settings app and disable the Location Service on iPhone. As we mentioned above, we will use JUnit as runner, but you can also choose TestNG or just create a standard Java program with the main() function.

Let’s create a before() method with annotation @Before where we will set up all of the necessary things for the desired test case.

Setting up Appium on Mac OS X for iOS virtual devices to test your application

In this post we will introduce the basic setup of Appium to work with iOS devices. We will go through with detailed steps, so you can skip some of those if you are familiar with.

For start you need to install Xcode. Go to the App Store, type Xcode, hit the download button and grab a coffee, it will take some time. Next step is to install Xcode command line tools. Open your default terminal application (Terminal, iTerm, etc.) and enter xcode-select –install. Click on Install button on the presented popup.
Xcode-Select modal
Agree the fine print, wait for the components to be installed and click on Done. Don’t forget to accept the license and agreements of Xcode. Simply start Xcode, accept the licenses and wait for the components to be installed. Now we are able to start our iPhone/iPad simulator so if you want to try it out, switch to your Xcode and choose Xcode/Open Developer Tool/Simulator. The downside is that you will have just iOS 9 installed, and you can’t change it to the older version. Next chapter is to install Appium and required packages.

Getting started with Android automation testing

As the automation testing is more and more present in the development of web and desktop applications it is also taking more place in the mobile world. There are various tools and frameworks helping the testers out the job.
First of all it is necessary to get the Android SDK and those API levels which are running on the target devices. Check this link for Android SDK: The recommended IDE for android development is the Android Studio, however the example in this guide is written in Eclipse. To add the android plugin to Eclipse follow this guide:

It is possible to run the test cases both on real and virtual devices. In the case if the target device is a virtual one there are two options. The first and more traditional way is using the android emulator which comes with the SDK or the other one is using Genymotion.

Genymotion is an emulator offers the same functionality as the traditional one and even more, beside that the boot of these devices is much faster. It can definitely improve the performance of the tests. You can download here:!/store. It is recommend to add the Genymotion plugin to Eclipse to make the job easier. Find the details on this page:!/download#genymotion-eclipse.

Create an Ant build for TestNG tests

The goal of this exercise is to run TestNG tests through Apache Ant.

First you have to have a sample TestNg project at your hand.
If you don’t have any, you can create the sample using the instructions below, or you can download it from using the link from the bottom of the post.
Create a simple class

package main;

import org.testng.annotations.Test;

public class ExampleTest {

	public void testA() throws Exception {

		System.out.println("Test finished.");


Wedbriver wait for ajax to finish and JQuery animation

JQuery’s ajax calls can make an automated tester’s life miserable if you don’t know how to handle them.

The quickest way to handle all of the Jquery ajax calls is to wait for the property to be null.
We can easily construct a sample code trough the JavasscriptExecutor class.It sends out JavaScript code which can be used for testing the property.

public void waitForAjaxToFinish() {
int timeout = 0;

while(timeout < 80) {
	boolean ajaxFinished = (boolean) ((JavascriptExecutor) driver)
			.executeScript("return !!jQuery && == 0");

throw new AssertionError("Ajax haven't finished its job in 40 sec");

The above showed code is best for a single Ajax requests, but when we have multiple Ajax requests there can be problems.
Multiple Ajax requests have different completion time and there is no guarantee that there is no fancy Ajax refresher gadget used, which can make previous wait function timeout.

Cookie manipulation in webdriver sessions

Manipulating cookies in selenium Webdriver sessions is really easy, it can enhance your testing and you can make more detailed logs and pinpointing issues.
To be able to insert a cookie you have to have a Webdriver instance at hand, you have to create a Webdriver cookie add it to your Webdriver instance.
To create a cookie you can use on of the constructors of the org.openqa.selenium.Cookie class:

Cookie(java.lang.String name, java.lang.String value)

Create a cookie for the default path with the given name and value with no expiry set.

Cookie(java.lang.String name, java.lang.String value, java.lang.String path)

Create a cookie with the given name value and path.

Cookie(java.lang.String name, java.lang.String value, java.lang.String path, java.util.Date expiry)

Creates an insecure non-httpOnly cookie with no domain specified.

Emulate mobile and tablet devices with ChromeDriver

Desktop version of Google Chrome allows to users to open webpages in mobile view. This means that you can emulate browsing on devices like Google Nexus 5, Apple iPhone 6 etc. You can find this feature in developer tools by clicking on the mobile icon.

Mobile emulation button

Mobile emulation button

Now ChromeDriver allows to use device emulation in automated tests also. This feature speeds up web development, allows developers to quickly test how a website will render on a mobile device, without requiring a real device or a virtual machine. You can find more information about it on the following link The setup is very easy and it’s working really well. Below you can find a little test case which will introduce to you how to use ChromeDriver for emulate a mobile device and tablet. The test case simply enters “what is my browser” into the google search page, clicks on the first result and checks the device type what will be present on the website.

@DataProvider(name = "deviceName")
	public Object[][] deviceNames(){
		return new Object[][] {
				{"Google Nexus 5", "LG Nexus 5"},
				{"Apple iPhone 6", "Apple iPhone"},
				{"Google Nexus 10", "Samsung Nexus 10"}

	@Test(dataProvider = "deviceName")
	public void mobileEmulation(String deviceName, String deviceNameWhatIsMyBrowser){
		Map<String, String> mobileEmulation = new HashMap<String, String>();
		mobileEmulation.put("deviceName", deviceName);

		Map<String, Object> chromeOptions = new HashMap<String, Object>();
		chromeOptions.put("mobileEmulation", mobileEmulation);
		DesiredCapabilities capabilities =;
		capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
		WebDriver driver = new ChromeDriver(capabilities);

		//Enter my search
		driver.findElement(By.cssSelector("#lst-ib")).sendKeys("what is my browser");
		//Click on search button
		//Click on the first found result
		//Get the device name from the website
		String deviceNameFromWebsite = driver.findElement(By.cssSelector(".string-extra-info")).getText();
		//Check the device name from the website
		Assert.assertEquals(deviceNameFromWebsite, deviceNameWhatIsMyBrowser, "The device name is not the expected one.");