[testng-users] executing a testmethod in parallel

42 views
Skip to first unread message

arulP

unread,
Feb 2, 2010, 12:32:02 AM2/2/10
to testng...@googlegroups.com

Hi,
My problem looks like this.I have a test method and which has a data
provider.Every time when I execute the test the testmethod executes
sequentially taking the values from the data provider for every iteration.Is
is possible to parallelize this,like if I have 5 iterations,whether the 5
iterations can be executed sequentially,like 5 threads of that test method
can be spawned? each thread taking unique values .If so how can I achieve
it?Please enlighten.

Thanks,
Arul
--
View this message in context: http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27415726.html
Sent from the testng-users mailing list archive at Nabble.com.

Cédric Beust ♔

unread,
Feb 2, 2010, 12:43:39 AM2/2/10
to testng...@googlegroups.com
Are you using the latest version?  (5.11)

--
Cedric



--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.




--
Cédric


arulP

unread,
Feb 2, 2010, 2:24:30 AM2/2/10
to testng...@googlegroups.com

Yes,I am using the version 5.11

>> testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>


>> .
>> For more options, visit this group at
>> http://groups.google.com/group/testng-users?hl=en.
>>
>>
>
>
> --

> ***Cédric
> *


>
> --
> You received this message because you are subscribed to the Google Groups
> "testng-users" group.
> To post to this group, send email to testng...@googlegroups.com.
> To unsubscribe from this group, send email to
> testng-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/testng-users?hl=en.
>
>
>

--
View this message in context: http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27416359.html

Cédric Beust ♔

unread,
Feb 2, 2010, 2:36:47 AM2/2/10
to testng...@googlegroups.com
Then make sure that parallel="methods", optionally set data-provider-thread-count and you should see every data provider invocation run in different threads...

--
Cedric
Cédric


arulP

unread,
Feb 2, 2010, 3:21:13 AM2/2/10
to testng...@googlegroups.com

still parallel iteration is not happening.This is how my testng.xml looks
like


<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="5" skipfailedinvocationCounts="false" verbose="1"
name="quickSetupAuto" junit="false" parallel="false" annotations="JDK"
data-provider-thread-count="10">
<test verbose="2" name="quicksetup.google" junit="false"
annotations="JDK">
<classes>
<class name="quicksetup.google"/>
</classes>
</test>
</suite>

>> <testng-users%2Bunsu...@googlegroups.com<testng-users%252Buns...@googlegroups.com>


>> >
>> >> .
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/testng-users?hl=en.
>> >>
>> >>
>> >
>> >
>> > --
>> > ***Cédric
>> > *
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "testng-users" group.
>> > To post to this group, send email to testng...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> >
>> testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>
>> .
>> > For more options, visit this group at
>> > http://groups.google.com/group/testng-users?hl=en.
>> >
>> >
>> >
>>
>> --

>> View this message in context:
>> http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27416359.html
>> Sent from the testng-users mailing list archive at Nabble.com.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "testng-users" group.
>> To post to this group, send email to testng...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/testng-users?hl=en.
>>
>>
>
>
> --
> ***Cédric
> *
>
> --
> You received this message because you are subscribed to the Google Groups
> "testng-users" group.
> To post to this group, send email to testng...@googlegroups.com.
> To unsubscribe from this group, send email to
> testng-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/testng-users?hl=en.
>
>
>

--
View this message in context: http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27416796.html

Cédric Beust ♔

unread,
Feb 2, 2010, 3:26:17 AM2/2/10
to testng...@googlegroups.com
parallel is false in your <suite>.
Cédric


arulP

unread,
Feb 2, 2010, 3:36:46 AM2/2/10
to testng...@googlegroups.com

Actually my testng .xml file exists as testng.xml.html.I can't find the
testng.xml file.Previously I was changing in testng.xml.html only.I guess
its an output file.Where can I find the testng.xml?I am using eclipse.

>> <testng-users%2Bunsu...@googlegroups.com<testng-users%252Buns...@googlegroups.com>
>> <testng-users%252Buns...@googlegroups.com<testng-users%25252Bun...@googlegroups.com>


>> >
>> >> >
>> >> >> .
>> >> >> For more options, visit this group at
>> >> >> http://groups.google.com/group/testng-users?hl=en.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > ***Cédric
>> >> > *
>> >> >
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> Groups
>> >> > "testng-users" group.
>> >> > To post to this group, send email to testng...@googlegroups.com.
>> >> > To unsubscribe from this group, send email to
>> >> >
>> >>
>> testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>
>> <testng-users%2Bunsu...@googlegroups.com<testng-users%252Buns...@googlegroups.com>
>> >
>> >> .
>> >> > For more options, visit this group at
>> >> > http://groups.google.com/group/testng-users?hl=en.
>> >> >
>> >> >
>> >> >
>> >>
>> >> --

>> http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27416796.html
>> Sent from the testng-users mailing list archive at Nabble.com.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "testng-users" group.
>> To post to this group, send email to testng...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/testng-users?hl=en.
>>
>>
>
>
> --
> ***Cédric
> *
>
> --
> You received this message because you are subscribed to the Google Groups
> "testng-users" group.
> To post to this group, send email to testng...@googlegroups.com.
> To unsubscribe from this group, send email to
> testng-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/testng-users?hl=en.
>
>
>

--
View this message in context: http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27416972.html

arulP

unread,
Feb 2, 2010, 4:47:18 AM2/2/10
to testng...@googlegroups.com

I have created my own suite xml file.I also changed the parameter
'parallel=methods' in it.Still not working.pls help

My suite xml file:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="5" skipfailedinvocationCounts="false" verbose="1"

name="Suite" junit="false" parallel="methods" annotations="JDK"
data-provider-thread-count="10">
<test name="Test" junit="false">
<classes>
<class name="NewTest"/>
</classes>
</test>
</suite>

--
View this message in context: http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27417765.html

Cédric Beust ♔

unread,
Feb 2, 2010, 7:07:29 AM2/2/10
to testng...@googlegroups.com
Can you make sure your tests are running in the same thread, e.g. by displaying the thread id?  If they are, please post the relevant code here.

--
Cedric

Cédric


arulP

unread,
Feb 3, 2010, 12:30:17 AM2/3/10
to testng...@googlegroups.com

Actually my code is a selenium testcase and the data provider is an excel
sheet.


import com.thoughtworks.selenium.*;

import org.testng.annotations.*;

import static org.testng.Assert.*;
import java.util.regex.Pattern;

import org.junit.AfterClass;
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;

import java.io.File;
import jxl.*;


public class NewTest extends SeleneseTestCase{

RemoteControlConfiguration rc;

public NewTest() {
rc = new RemoteControlConfiguration();
}

@DataProvider(name = "DP1", parallel = true)
public Object[][] createData1() {
Object[][] retObjArr = getTableArray(
"src\\Data\\data1.xls", "DataPool2",
"TestData1");
return (retObjArr);
}

@AfterClass
public void tearDown() {
selenium.close();
selenium.stop();
}

public String[][] getTableArray(String xlFilePath, String sheetName,
String tableName) {
String[][] tabArray = null;
try {
Workbook workbook = Workbook.getWorkbook(new File(xlFilePath));
Sheet sheet = workbook.getSheet(sheetName);
int startRow, startCol, endRow, endCol, ci, cj;
Cell tableStart = sheet.findCell(tableName);
startRow = tableStart.getRow();
startCol = tableStart.getColumn();

Cell tableEnd = sheet.findCell(tableName, startCol + 1,
startRow + 1, 100, 64000, false);

endRow = tableEnd.getRow();
endCol = tableEnd.getColumn();
System.out.println("startRow=" + startRow + ", endRow=" + endRow
+ ", " + "startCol=" + startCol + ", endCol=" + endCol);
tabArray = new String[endRow - startRow - 1][endCol - startCol - 1];
ci = 0;

for (int i = startRow + 1; i < endRow; i++, ci++) {
cj = 0;
for (int j = startCol + 1; j < endCol; j++, cj++) {
tabArray[ci][cj] = sheet.getCell(j, i).getContents();
}
}
} catch (Exception e) {
System.out.println("error in getTableArray()");
}
return (tabArray);
}

@Test(dataProvider = "DP1")
public void testGoogle(String text,String port) throws Exception {
rc.setPort(Integer.parseInt(port));
SeleniumServer seleniumserver = new SeleniumServer(rc);
seleniumserver.boot();
seleniumserver.start();
Selenium selenium = new DefaultSelenium("localhost",
Integer.parseInt(port), "*firefox", "http://www.google.com/");
selenium.start();
selenium.setSpeed("1000");
selenium.open("/");
selenium.click("q");
selenium.type("q", text);
selenium.click("btnG");
}

}

>> <testng-users%2Bunsu...@googlegroups.com<testng-users%252Buns...@googlegroups.com>
>> <testng-users%252Buns...@googlegroups.com<testng-users%25252Bun...@googlegroups.com>
>> >
>> >>>
>> <testng-users%252Buns...@googlegroups.com<testng-users%25252Bun...@googlegroups.com>
>> <testng-users%25252Bun...@googlegroups.com<testng-users%2525252Bu...@googlegroups.com>


>> >
>> >>> >
>> >>> >> >
>> >>> >> >> .
>> >>> >> >> For more options, visit this group at
>> >>> >> >> http://groups.google.com/group/testng-users?hl=en.
>> >>> >> >>
>> >>> >> >>
>> >>> >> >
>> >>> >> >
>> >>> >> > --
>> >>> >> > ***Cédric
>> >>> >> > *
>> >>> >> >
>> >>> >> > --
>> >>> >> > You received this message because you are subscribed to the
>> Google
>> >>> >> Groups
>> >>> >> > "testng-users" group.
>> >>> >> > To post to this group, send email to
>> testng...@googlegroups.com.
>> >>> >> > To unsubscribe from this group, send email to
>> >>> >> >
>> >>> >>
>> >>>
>> testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>
>> <testng-users%2Bunsu...@googlegroups.com<testng-users%252Buns...@googlegroups.com>
>> >
>> >>>
>> <testng-users%2Bunsu...@googlegroups.com<testng-users%252Buns...@googlegroups.com>
>> <testng-users%252Buns...@googlegroups.com<testng-users%25252Bun...@googlegroups.com>
>> >
>> >>> >
>> >>> >> .
>> >>> >> > For more options, visit this group at
>> >>> >> > http://groups.google.com/group/testng-users?hl=en.
>> >>> >> >
>> >>> >> >
>> >>> >> >
>> >>> >>
>> >>> >> --

>> http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27417765.html
>> Sent from the testng-users mailing list archive at Nabble.com.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "testng-users" group.
>> To post to this group, send email to testng...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/testng-users?hl=en.
>>
>>
>
>
> --
> ***Cédric
> *
>
> --
> You received this message because you are subscribed to the Google Groups
> "testng-users" group.
> To post to this group, send email to testng...@googlegroups.com.
> To unsubscribe from this group, send email to
> testng-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/testng-users?hl=en.
>
>
>

--
View this message in context: http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27431038.html

arulP

unread,
Feb 3, 2010, 12:43:13 AM2/3/10
to testng...@googlegroups.com

Please ignore the 'parallel = true' attribute in the data provider.I was just
checking if it will work.

import com.thoughtworks.selenium.*;

import org.testng.annotations.*;

import static org.testng.Assert.*;
import java.util.regex.Pattern;

import org.junit.AfterClass;
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;

import java.io.File;
import jxl.*;


public class NewTest extends SeleneseTestCase{

RemoteControlConfiguration rc;

public NewTest() {
rc = new RemoteControlConfiguration();
}

@DataProvider(name = "DP1")

--
View this message in context: http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27431039.html

arulP

unread,
Feb 3, 2010, 12:43:20 AM2/3/10
to testng...@googlegroups.com

Please ignore the 'parallel = true' attribute in the data provider.I was just
checking if it will work.

import com.thoughtworks.selenium.*;

import org.testng.annotations.*;

import static org.testng.Assert.*;
import java.util.regex.Pattern;

import org.junit.AfterClass;
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;

import java.io.File;
import jxl.*;


public class NewTest extends SeleneseTestCase{

RemoteControlConfiguration rc;

public NewTest() {
rc = new RemoteControlConfiguration();
}

@DataProvider(name = "DP1")

--
View this message in context: http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27431040.html

Cédric Beust ♔

unread,
Feb 3, 2010, 1:00:12 AM2/3/10
to testng...@googlegroups.com
So how do you know that each invocation is not run in parallel?  Did you check the thread id on each, for example?

And yes, you need parallel=true in @DataProvider.

--
Cedric

Cédric


arulP

unread,
Feb 3, 2010, 1:26:23 AM2/3/10
to testng...@googlegroups.com

I didn't check the thread id.I can see from my output that the execution is
happening sequentially.My testcase starts up a browser for execution. Here
for two iterations it should open up 2 browser instances simultaneoulsly.but
its not doing so(does it sequentially).I ll paste the outputs for
execution(without 'parallel = true' attribute and with 'parallel = true' ).


O/P: (without parallel = true)

[Parser] Running:
C:\Documents and Settings\prakaa2\Local
Settings\Temp\testng-eclipse\testng-customsuite.xml

startRow=0, endRow=3, startCol=0, endCol=3
11:48:59.566 INFO - Java: Sun Microsystems Inc. 16.0-b13
11:48:59.566 INFO - OS: Windows XP 5.1 x86
11:48:59.582 INFO - v1.0.1 [2696], with Core v@VERSION@ [@REVISION@]
11:48:59.722 INFO - Version Jetty/5.1.x
11:48:59.722 INFO - Started
HttpContext[/selenium-server/driver,/selenium-server/driver]
11:48:59.722 INFO - Started HttpContext[/selenium-server,/selenium-server]
11:48:59.722 INFO - Started HttpContext[/,/]
11:48:59.738 INFO - Started SocketListener on 0.0.0.0:5525
11:48:59.738 INFO - Started org.mortbay.jetty.Server@199f91c
11:48:59.895 INFO - Checking Resource aliases
11:48:59.910 INFO - Command request: getNewBrowserSession[*firefox,
http://www.google.com/, ] on session null
11:48:59.910 INFO - creating new remote session
11:49:00.349 INFO - Allocated session 15fc78eeaa1545118341bba92cc5fff4 for
http://www.google.com/, launching...
11:49:00.755 INFO - Preparing Firefox profile...
11:49:06.609 INFO - Launching Firefox...
11:49:12.071 INFO - Got result: OK,15fc78eeaa1545118341bba92cc5fff4 on
session 15fc78eeaa1545118341bba92cc5fff4
11:49:12.103 INFO - Command request: setSpeed[1000, ] on session
15fc78eeaa1545118341bba92cc5fff4
11:49:12.103 INFO - Got result: OK on session
15fc78eeaa1545118341bba92cc5fff4
11:49:12.118 INFO - Command request: open[/, ] on session
15fc78eeaa1545118341bba92cc5fff4
11:49:21.853 INFO - Got result: OK on session
15fc78eeaa1545118341bba92cc5fff4
11:49:21.869 INFO - Command request: click[q, ] on session
15fc78eeaa1545118341bba92cc5fff4
11:49:22.886 INFO - Got result: OK on session
15fc78eeaa1545118341bba92cc5fff4
11:49:22.902 INFO - Command request: type[q, fire] on session
15fc78eeaa1545118341bba92cc5fff4
11:49:23.919 INFO - Got result: OK on session
15fc78eeaa1545118341bba92cc5fff4
11:49:23.935 INFO - Command request: click[btnG, ] on session
15fc78eeaa1545118341bba92cc5fff4
11:49:25.046 INFO - Got result: OK on session
15fc78eeaa1545118341bba92cc5fff4
11:49:25.062 INFO - Java: Sun Microsystems Inc. 16.0-b13
11:49:25.062 INFO - OS: Windows XP 5.1 x86
11:49:25.062 INFO - v1.0.1 [2696], with Core v@VERSION@ [@REVISION@]
11:49:25.078 INFO - Version Jetty/5.1.x
11:49:25.078 INFO - Started
HttpContext[/selenium-server/driver,/selenium-server/driver]
11:49:25.078 INFO - Started HttpContext[/selenium-server,/selenium-server]
11:49:25.078 INFO - Started HttpContext[/,/]
11:49:25.078 INFO - Started SocketListener on 0.0.0.0:5526
11:49:25.078 INFO - Started org.mortbay.jetty.Server@ca470
11:49:25.078 INFO - Command request: getNewBrowserSession[*firefox,
http://www.google.com/, ] on session null
11:49:25.078 INFO - creating new remote session
11:49:25.078 INFO - Allocated session b1f6a613d06144bea64ca4e27760171d for
http://www.google.com/, launching...
11:49:25.234 INFO - Preparing Firefox profile...
11:49:28.537 INFO - Launching Firefox...
11:49:32.308 INFO - Got result: OK,b1f6a613d06144bea64ca4e27760171d on
session b1f6a613d06144bea64ca4e27760171d
11:49:32.308 INFO - Command request: setSpeed[1000, ] on session
b1f6a613d06144bea64ca4e27760171d
11:49:32.308 INFO - Got result: OK on session
b1f6a613d06144bea64ca4e27760171d
11:49:32.324 INFO - Command request: open[/, ] on session
b1f6a613d06144bea64ca4e27760171d
11:49:36.159 INFO - Got result: OK on session
b1f6a613d06144bea64ca4e27760171d
11:49:36.174 INFO - Command request: click[q, ] on session
b1f6a613d06144bea64ca4e27760171d
11:49:37.207 INFO - Got result: OK on session
b1f6a613d06144bea64ca4e27760171d
11:49:37.207 INFO - Command request: type[q, dark] on session
b1f6a613d06144bea64ca4e27760171d
11:49:38.240 INFO - Got result: OK on session
b1f6a613d06144bea64ca4e27760171d
11:49:38.240 INFO - Command request: click[btnG, ] on session
b1f6a613d06144bea64ca4e27760171d
11:49:39.868 INFO - Got result: OK on session
b1f6a613d06144bea64ca4e27760171d
PASSED: testGoogle on instance null(NewTest)("fire", "5525")
PASSED: testGoogle on instance null(NewTest)("dark", "5526")

===============================================
NewTest
Tests run: 2, Failures: 0, Skips: 0
===============================================


===============================================
googleTest
Total tests run: 2, Failures: 0, Skips: 0
===============================================

[org.testng.internal.PoolService] Shutting down poolservice
org.testng.internal.PoolService@609959 terminated:false
11:49:40.619 INFO - Shutting down...
11:49:40.619 INFO - Shutting down...
11:49:40.619 INFO - Shutting down...
11:49:40.619 INFO - Shutting down...


You can see that(in bold) the 'launching firefox' is not happening
parallely.I want it to happen parallely.

O/P(with parallel = true)

[Parser] Running:
C:\Documents and Settings\prakaa2\Local
Settings\Temp\testng-eclipse\testng-customsuite.xml

startRow=0, endRow=3, startCol=0, endCol=3
11:53:04.954 INFO - Java: Sun Microsystems Inc. 16.0-b13
11:53:04.954 INFO - Java: Sun Microsystems Inc. 16.0-b13
11:53:04.954 INFO - OS: Windows XP 5.1 x86
11:53:04.954 INFO - OS: Windows XP 5.1 x86
11:53:04.970 INFO - v1.0.1 [2696], with Core v@VERSION@ [@REVISION@]
11:53:04.970 INFO - v1.0.1 [2696], with Core v@VERSION@ [@REVISION@]
11:53:05.158 INFO - Version Jetty/5.1.x
11:53:05.173 INFO - Started
HttpContext[/selenium-server/driver,/selenium-server/driver]
11:53:05.173 INFO - Started HttpContext[/selenium-server,/selenium-server]
11:53:05.173 INFO - Started HttpContext[/,/]
11:53:05.173 INFO - Version Jetty/5.1.x
11:53:05.173 INFO - Started
HttpContext[/selenium-server/driver,/selenium-server/driver]
11:53:05.173 INFO - Started HttpContext[/selenium-server,/selenium-server]
11:53:05.173 INFO - Started HttpContext[/,/]
11:53:05.173 WARN - Failed to start: SocketL...@0.0.0.0:5525
11:53:05.220 INFO - Started SocketListener on 0.0.0.0:5525
11:53:05.220 INFO - Started org.mortbay.jetty.Server@1ccce3c
FAILED: testGoogle on instance null(NewTest)("fire", "5525")
java.net.BindException: Selenium is already running on port 5525. Or some
other service is.
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:378)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:224)
at NewTest.testGoogle(NewTest.java:77)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
... Removed 9 stack frames
FAILED: testGoogle on instance null(NewTest)("dark", "5526")
java.lang.RuntimeException: Could not contact Selenium Server; have you
started it on 'localhost:5526' ?
Read more at http://seleniumhq.org/projects/remote-control/not-started.html
Connection refused: connect
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:86)
at NewTest.testGoogle(NewTest.java:80)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
... Removed 9 stack frames

===============================================
NewTest
Tests run: 2, Failures: 2, Skips: 0
===============================================


===============================================
googleTest
Total tests run: 2, Failures: 2, Skips: 0
===============================================

[org.testng.internal.PoolService] Shutting down poolservice
org.testng.internal.PoolService@2a15cd terminated:false
11:53:07.487 INFO - Shutting down...
11:53:07.487 INFO - Shutting down...
11:53:07.487 INFO - Stopping Acceptor
ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=5525]


My test is a failure.Because only one instance of selenium server can run in
a port.What I can guess is its instantiating two instances for a same
testcase(2 instances for same row of data).what am i doing wrong?pls help

>> <testng-users%252Buns...@googlegroups.com<testng-users%25252Bun...@googlegroups.com>
>> <testng-users%25252Bun...@googlegroups.com<testng-users%2525252Bu...@googlegroups.com>
>> >
>> >>
>> <testng-users%25252Bun...@googlegroups.com<testng-users%2525252Bu...@googlegroups.com>
>> <testng-users%2525252Bu...@googlegroups.com<testng-users%252525252B...@googlegroups.com>

>> http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27431038.html
>> Sent from the testng-users mailing list archive at Nabble.com.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "testng-users" group.
>> To post to this group, send email to testng...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/testng-users?hl=en.
>>
>>
>
>
> --
> ***Cédric
> *
>
> --
> You received this message because you are subscribed to the Google Groups
> "testng-users" group.
> To post to this group, send email to testng...@googlegroups.com.
> To unsubscribe from this group, send email to
> testng-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/testng-users?hl=en.
>
>
>

--
View this message in context: http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27432031.html

Cédric Beust ♔

unread,
Feb 3, 2010, 1:57:08 AM2/3/10
to testng...@googlegroups.com
There are many reasons why your browser windows appear sequentially even though the test methods are running in parallel, please double check the thread id's.

--
Cedric

Cédric


arulP

unread,
Feb 3, 2010, 2:56:52 AM2/3/10
to testng...@googlegroups.com

I checked the thread IDs ,they are same for both the iterations,It displayed
1 when I used "Thread.currentThread.getId()" inside my test method.


O/P:


[Parser] Running:
C:\Documents and Settings\prakaa2\Local
Settings\Temp\testng-eclipse\testng-customsuite.xml

startRow=0, endRow=3, startCol=0, endCol=3
ID :1
13:23:09.875 INFO - Java: Sun Microsystems Inc. 16.0-b13
13:23:09.875 INFO - OS: Windows XP 5.1 x86
13:23:09.891 INFO - v1.0.1 [2696], with Core v@VERSION@ [@REVISION@]
13:23:10.016 INFO - Version Jetty/5.1.x
13:23:10.016 INFO - Started
HttpContext[/selenium-server/driver,/selenium-server/driver]
13:23:10.016 INFO - Started HttpContext[/selenium-server,/selenium-server]
13:23:10.016 INFO - Started HttpContext[/,/]
13:23:10.032 INFO - Started SocketListener on 0.0.0.0:5525
13:23:10.032 INFO - Started org.mortbay.jetty.Server@27391d
13:23:10.141 INFO - Checking Resource aliases
13:23:10.157 INFO - Command request: getNewBrowserSession[*firefox,


http://www.google.com/, ] on session null

13:23:10.157 INFO - creating new remote session
13:23:10.438 INFO - Allocated session 7cdc8165dffb45a699133d34a95517ee for
http://www.google.com/, launching...
13:23:10.579 INFO - Preparing Firefox profile...
13:23:14.641 INFO - Launching Firefox...
13:23:18.688 INFO - Got result: OK,7cdc8165dffb45a699133d34a95517ee on
session 7cdc8165dffb45a699133d34a95517ee
13:23:18.704 INFO - Command request: setSpeed[1000, ] on session
7cdc8165dffb45a699133d34a95517ee
13:23:18.704 INFO - Got result: OK on session
7cdc8165dffb45a699133d34a95517ee
13:23:18.704 INFO - Command request: open[/, ] on session
7cdc8165dffb45a699133d34a95517ee
13:23:22.673 INFO - Got result: OK on session
7cdc8165dffb45a699133d34a95517ee
13:23:22.673 INFO - Command request: click[q, ] on session
7cdc8165dffb45a699133d34a95517ee
13:23:23.704 INFO - Got result: OK on session
7cdc8165dffb45a699133d34a95517ee
13:23:23.720 INFO - Command request: type[q, fire] on session
7cdc8165dffb45a699133d34a95517ee
13:23:24.736 INFO - Got result: OK on session
7cdc8165dffb45a699133d34a95517ee
13:23:24.751 INFO - Command request: click[btnG, ] on session
7cdc8165dffb45a699133d34a95517ee
13:23:26.845 INFO - Got result: OK on session
7cdc8165dffb45a699133d34a95517ee
ID :1
13:23:26.861 INFO - Java: Sun Microsystems Inc. 16.0-b13
13:23:26.861 INFO - OS: Windows XP 5.1 x86
13:23:26.861 INFO - v1.0.1 [2696], with Core v@VERSION@ [@REVISION@]
13:23:26.861 INFO - Version Jetty/5.1.x
13:23:26.861 INFO - Started
HttpContext[/selenium-server/driver,/selenium-server/driver]
13:23:26.861 INFO - Started HttpContext[/selenium-server,/selenium-server]
13:23:26.861 INFO - Started HttpContext[/,/]
13:23:26.861 INFO - Started SocketListener on 0.0.0.0:5526
13:23:26.861 INFO - Started org.mortbay.jetty.Server@142bece
13:23:26.876 INFO - Command request: getNewBrowserSession[*firefox,


http://www.google.com/, ] on session null

13:23:26.892 INFO - creating new remote session
13:23:26.892 INFO - Allocated session d67a803a63774f90b4fee8ad4cd09dea for
http://www.google.com/, launching...
13:23:27.142 INFO - Preparing Firefox profile...
13:23:31.689 INFO - Launching Firefox...
13:23:35.689 INFO - Got result: OK,d67a803a63774f90b4fee8ad4cd09dea on
session d67a803a63774f90b4fee8ad4cd09dea
13:23:35.689 INFO - Command request: setSpeed[1000, ] on session
d67a803a63774f90b4fee8ad4cd09dea
13:23:35.704 INFO - Got result: OK on session
d67a803a63774f90b4fee8ad4cd09dea
13:23:35.704 INFO - Command request: open[/, ] on session
d67a803a63774f90b4fee8ad4cd09dea
13:23:38.814 INFO - Got result: OK on session
d67a803a63774f90b4fee8ad4cd09dea
13:23:38.814 INFO - Command request: click[q, ] on session
d67a803a63774f90b4fee8ad4cd09dea
13:23:39.830 INFO - Got result: OK on session
d67a803a63774f90b4fee8ad4cd09dea
13:23:39.845 INFO - Command request: type[q, dark] on session
d67a803a63774f90b4fee8ad4cd09dea
13:23:40.876 INFO - Got result: OK on session
d67a803a63774f90b4fee8ad4cd09dea
13:23:40.876 INFO - Command request: click[btnG, ] on session
d67a803a63774f90b4fee8ad4cd09dea
13:23:43.345 INFO - Got result: OK on session
d67a803a63774f90b4fee8ad4cd09dea


PASSED: testGoogle on instance null(NewTest)("fire", "5525")
PASSED: testGoogle on instance null(NewTest)("dark", "5526")

===============================================
NewTest
Tests run: 2, Failures: 0, Skips: 0
===============================================


===============================================
googleTest
Total tests run: 2, Failures: 0, Skips: 0
===============================================

[org.testng.internal.PoolService] Shutting down poolservice
org.testng.internal.PoolService@1f82982 terminated:false
13:23:43.720 INFO - Shutting down...
13:23:43.720 INFO - Shutting down...
13:23:43.720 INFO - Shutting down...

>> <testng-users%25252Bun...@googlegroups.com<testng-users%2525252Bu...@googlegroups.com>
>> <testng-users%2525252Bu...@googlegroups.com<testng-users%252525252B...@googlegroups.com>
>> >
>> >>
>> <testng-users%2525252Bu...@googlegroups.com<testng-users%252525252B...@googlegroups.com>
>> <testng-users%252525252B...@googlegroups.com<testng-users%25252525252...@googlegroups.com>

>> http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27432031.html
>> Sent from the testng-users mailing list archive at Nabble.com.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "testng-users" group.
>> To post to this group, send email to testng...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/testng-users?hl=en.
>>
>>
>
>
> --
> ***Cédric
> *
>
> --
> You received this message because you are subscribed to the Google Groups
> "testng-users" group.
> To post to this group, send email to testng...@googlegroups.com.
> To unsubscribe from this group, send email to
> testng-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/testng-users?hl=en.
>
>
>

--
View this message in context: http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27432627.html

arulP

unread,
Feb 3, 2010, 3:08:40 AM2/3/10
to testng...@googlegroups.com

But when I run it with "parallel = true" attribute my testcase fails. It
shows the error which i have mentioned in previous post.

--
View this message in context: http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27432750.html

arulP

unread,
Feb 3, 2010, 5:07:59 AM2/3/10
to testng...@googlegroups.com

I guess the parallel iteration is working. Now I am getting different thread
IDs.But I get different o/ps when I run and when I debug. When I debug its
working fine and both the test cases pass.But when I run it fails.can you
tell me why that is?The o/p also looks different.

O/P(debug):
[Parser] Running:
C:\Documents and Settings\prakaa2\workspace\googleTest\src\goog.xml

startRow=0, endRow=3, startCol=0, endCol=3
Search str :fire
Port :5415
ID :14
15:27:28.246 INFO - Java: Sun Microsystems Inc. 16.0-b13
15:27:28.262 INFO - OS: Windows XP 5.1 x86
15:27:28.480 INFO - v1.0.1 [2696], with Core v@VERSION@ [@REVISION@]
15:27:37.090 INFO - Version Jetty/5.1.x
15:27:37.105 INFO - Started
HttpContext[/selenium-server/driver,/selenium-server/driver]
15:27:37.137 INFO - Started HttpContext[/selenium-server,/selenium-server]
15:27:37.137 INFO - Started HttpContext[/,/]
15:27:37.199 INFO - Started SocketListener on 0.0.0.0:5415
15:27:37.199 INFO - Started org.mortbay.jetty.Server@682406
15:27:43.496 INFO - Checking Resource aliases
15:27:43.496 INFO - Command request: getNewBrowserSession[*firefox,


http://www.google.com/, ] on session null

15:27:43.512 INFO - creating new remote session
15:27:43.793 INFO - Allocated session c3d932e6dc0c4c21abeb7aa708e99dbc for
http://www.google.com/, launching...
15:27:43.933 INFO - Preparing Firefox profile...
15:27:47.355 INFO - Launching Firefox...
15:27:51.433 INFO - Got result: OK,c3d932e6dc0c4c21abeb7aa708e99dbc on
session c3d932e6dc0c4c21abeb7aa708e99dbc
15:28:00.355 INFO - Command request: setSpeed[1000, ] on session
c3d932e6dc0c4c21abeb7aa708e99dbc
15:28:00.355 INFO - Got result: OK on session
c3d932e6dc0c4c21abeb7aa708e99dbc
15:28:01.058 INFO - Command request: open[/, ] on session
c3d932e6dc0c4c21abeb7aa708e99dbc
15:28:08.668 INFO - Got result: OK on session
c3d932e6dc0c4c21abeb7aa708e99dbc
15:28:09.637 INFO - Command request: click[q, ] on session
c3d932e6dc0c4c21abeb7aa708e99dbc
15:28:11.824 INFO - Got result: OK on session
c3d932e6dc0c4c21abeb7aa708e99dbc
15:28:13.012 INFO - Command request: type[q, fire] on session
c3d932e6dc0c4c21abeb7aa708e99dbc
15:28:14.808 INFO - Got result: OK on session
c3d932e6dc0c4c21abeb7aa708e99dbc
15:28:16.105 INFO - Command request: click[btnG, ] on session
c3d932e6dc0c4c21abeb7aa708e99dbc
15:28:18.105 INFO - Got result: OK on session
c3d932e6dc0c4c21abeb7aa708e99dbc
Search str :dark
Port :5416
ID :15
15:29:03.559 INFO - Java: Sun Microsystems Inc. 16.0-b13
15:29:03.559 INFO - OS: Windows XP 5.1 x86
15:29:03.574 INFO - v1.0.1 [2696], with Core v@VERSION@ [@REVISION@]
15:29:03.605 INFO - Version Jetty/5.1.x
15:29:03.605 INFO - Started
HttpContext[/selenium-server/driver,/selenium-server/driver]
15:29:03.605 INFO - Started HttpContext[/selenium-server,/selenium-server]
15:29:03.605 INFO - Started HttpContext[/,/]
15:29:03.637 INFO - Started SocketListener on 0.0.0.0:5416
15:29:03.637 INFO - Started org.mortbay.jetty.Server@4ec59
15:29:03.684 INFO - Command request: getNewBrowserSession[*firefox,


http://www.google.com/, ] on session null

15:29:03.684 INFO - creating new remote session
15:29:03.699 INFO - Allocated session 1017f50960424d77b1f478389d1021ad for
http://www.google.com/, launching...
15:29:03.887 INFO - Preparing Firefox profile...
15:29:07.231 INFO - Launching Firefox...
15:29:12.403 INFO - Got result: OK,1017f50960424d77b1f478389d1021ad on
session 1017f50960424d77b1f478389d1021ad
15:29:12.418 INFO - Command request: setSpeed[1000, ] on session
1017f50960424d77b1f478389d1021ad
15:29:12.418 INFO - Got result: OK on session
1017f50960424d77b1f478389d1021ad
15:29:12.449 INFO - Command request: open[/, ] on session
1017f50960424d77b1f478389d1021ad
15:29:16.293 INFO - Got result: OK on session
1017f50960424d77b1f478389d1021ad
15:29:16.309 INFO - Command request: click[q, ] on session
1017f50960424d77b1f478389d1021ad
15:29:18.450 INFO - Got result: OK on session
1017f50960424d77b1f478389d1021ad
15:29:18.747 INFO - Command request: type[q, dark] on session
1017f50960424d77b1f478389d1021ad
15:29:20.778 INFO - Got result: OK on session
1017f50960424d77b1f478389d1021ad
15:29:21.075 INFO - Command request: click[btnG, ] on session
1017f50960424d77b1f478389d1021ad
15:29:23.028 INFO - Got result: OK on session
1017f50960424d77b1f478389d1021ad

===============================================
Suite


Total tests run: 2, Failures: 0, Skips: 0
===============================================

15:29:24.356 INFO - Shutting down...
15:29:24.356 INFO - Shutting down...
15:29:24.356 INFO - Shutting down...
15:29:24.372 INFO - Stopping Acceptor
ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=5415]
15:29:24.372 INFO - Shutting down...
15:29:24.372 INFO - Stopping Acceptor
ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=5416]

O/P(run):

[Parser] Running:
C:\Documents and Settings\prakaa2\Local
Settings\Temp\testng-eclipse\testng-customsuite.xml

startRow=0, endRow=3, startCol=0, endCol=3
Search str :dark
Port :5216
ID :11
Search str :fire
Port :5215
ID :10
15:35:25.006 INFO - Java: Sun Microsystems Inc. 16.0-b13
15:35:25.006 INFO - Java: Sun Microsystems Inc. 16.0-b13
15:35:25.006 INFO - OS: Windows XP 5.1 x86
15:35:25.006 INFO - OS: Windows XP 5.1 x86
15:35:25.022 INFO - v1.0.1 [2696], with Core v@VERSION@ [@REVISION@]
15:35:25.022 INFO - v1.0.1 [2696], with Core v@VERSION@ [@REVISION@]
15:35:25.147 INFO - Version Jetty/5.1.x
15:35:25.147 INFO - Version Jetty/5.1.x
15:35:25.147 INFO - Started
HttpContext[/selenium-server/driver,/selenium-server/driver]
15:35:25.147 INFO - Started
HttpContext[/selenium-server/driver,/selenium-server/driver]
15:35:25.147 INFO - Started HttpContext[/selenium-server,/selenium-server]
15:35:25.147 INFO - Started HttpContext[/selenium-server,/selenium-server]
15:35:25.147 INFO - Started HttpContext[/,/]
15:35:25.147 INFO - Started HttpContext[/,/]
15:35:25.147 WARN - Failed to start: SocketL...@0.0.0.0:5215
15:35:25.162 INFO - Started SocketListener on 0.0.0.0:5215
15:35:25.162 INFO - Started org.mortbay.jetty.Server@15e83f9
FAILED: testGoogle on instance null(NewTest)("fire", "5215")
java.net.BindException: Selenium is already running on port 5215. Or some


other service is.
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:378)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:224)

at NewTest.testGoogle(NewTest.java:83)


at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
... Removed 9 stack frames

FAILED: testGoogle on instance null(NewTest)("dark", "5216")


java.lang.RuntimeException: Could not contact Selenium Server; have you

started it on 'localhost:5216' ?


Read more at http://seleniumhq.org/projects/remote-control/not-started.html
Connection refused: connect
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:86)

at NewTest.testGoogle(NewTest.java:86)


at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
... Removed 9 stack frames

===============================================
NewTest
Tests run: 2, Failures: 2, Skips: 0
===============================================


===============================================
googleTest
Total tests run: 2, Failures: 2, Skips: 0
===============================================

[org.testng.internal.PoolService] Shutting down poolservice
org.testng.internal.PoolService@765a16 terminated:false

> O/P(debug):

--
View this message in context: http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27434025.html

arulP

unread,
Feb 3, 2010, 5:44:45 AM2/3/10
to testng...@googlegroups.com

Atlast I found my error.Now its working fine.Thanks Cedric.Your frame work
rocks!

--
View this message in context: http://old.nabble.com/executing-a-testmethod-in-parallel-tp27415726p27434467.html

Reply all
Reply to author
Forward
0 new messages