Action is performing twice in parallel tesing

Im trying to execute parallel testing for android using Testng. It working but the action are performing twice.

I created a simple android login application
Im trying to pass username and password, but it is passing twice.
if password is test it is passing as “testtest”.

Below is my sample code:

package Appium;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

import com.beust.jcommander.Parameter;

public class Appium {
WebDriver driver;

public void setup(String deviceName_, String UDID_, String platformVersion_, String URL_) throws MalformedURLException {
	File appDir = new File(System.getProperty("user.dir")+ "/Apps");
    File app = new File(appDir, "app-debug.apk");
	// Created object of DesiredCapabilities class.
	DesiredCapabilities capabilities = new DesiredCapabilities();

	// Set android deviceName desired capability. Set your device name.
	capabilities.setCapability("deviceName", deviceName_);

	// Set BROWSER_NAME desired capability. It's Android in our case here.
	capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");

	// Set android VERSION desired capability. Set your mobile device's OS
	// version.
	capabilities.setCapability("platformVersion", platformVersion_);

	// Set android platformName desired capability. It's Android in our case
	// here.
	capabilities.setCapability("platformName", "Android");
	capabilities.setCapability("udid", UDID_);

	// Set android appPackage desired capability. It is
	// for calculator application.
	// Set your application's appPackage if you are using any other app.
	capabilities.setCapability("appPackage", "");

	// Set android appActivity desired capability. It is
	// for calculator application.
	// Set your application's appPackage if you are using any other app.
	capabilities.setCapability("appActivity", "");
	capabilities.setCapability("app", app.getAbsolutePath());

	// Created object of RemoteWebDriver will all set capabilities.
	// Set appium server address and port number in URL string.
	// It will launch calculator app in android device.
	driver = new RemoteWebDriver(new URL("http://"+URL_), capabilities);
	driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);

public void test() {



<?xml version="1.0" encoding="UTF-8"?>

Have you mentioned 2 device names??

ya in xml i mentioned device one and device two

Please try this

public Object[][] portDriver()
//Rows - Number of times your test has to be repeated.
//Columns - Number of parameters in test data.
Object[][] data = new Object[2][1];

	// 1st row
	data[0][0] ="5d6ef2bd";
	// 2nd row
	data[1][0] ="d859dc2d";
	return data;

	public static String firstDeviceName="5d6ef2bd";
	public static String SecondDeviceName="d859dc2d";

		public void Init(String device_id) throws IOException, InterruptedException{
			DesiredCapabilities capabilities = new DesiredCapabilities();
				capabilities.setCapability("udid", firstDeviceName);
				driver1=new AndroidDriver(new URL(""), capabilities);
		        driver1.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
			}else if(device_id.equalsIgnoreCase(SecondDeviceName)){
				capabilities.setCapability("udid", SecondDeviceName);
				driver2=new AndroidDriver(new URL(""), capabilities);
		        driver2.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);			      

Here @Ajinkya you are using two drivers driver1 and driver2. For performing test whether i want to write separate scripts for each devices?

@hemachandran_R.S need parallel -> start from changing driver to local thread variable first.

a little to read more -