Parallel Execution with TestNG

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Parallel Execution with TestNG

anand_raja
Hi Tarun,

Got the below error(Highlighted in Red) for parallel Execution.
Can Please provide me the solution for this
...
... TestNG 6.8beta 20120825_1010 by Cédric Beust (cedric@beust.com)
...

[TestRunner] Running the tests in 'Run on Internet Explorer' with parallel mode:tests
[RunInfo] Adding method selector: org.testng.internal.XmlMethodSelector@347cdb priority: 10
[TestClass] Creating TestClass for [ClassImpl class=com.selenium.linkcheck.Sample]
[TestRunner] Running the tests in 'Run on Firefox' with parallel mode:tests
[RunInfo] Adding method selector: org.testng.internal.XmlMethodSelector@107e4bc priority: 10
[TestClass] Creating TestClass for [ClassImpl class=com.selenium.linkcheck.Sample]
[TestNG] Running:
  D:\Testing\Links CHecking\tesng1.xml

[SuiteRunner] Created 2 TestRunners
[ThreadUtil] Starting executor timeOut:2147483647ms workers:2 threadPoolSize:2
[TestRunner] Running test Run on Internet Explorer on 1  classes,  included groups:[] excluded groups:[]
===== Test class
com.selenium.linkcheck.Sample
[TestRunner] Running test Run on Firefox on 1  classes,  included groups:[] excluded groups:[]
  @BeforeClass Sample.setup(java.lang.String)[pri:0, instance:com.selenium.linkcheck.Sample@1ac8e09]
===== Test class
com.selenium.linkcheck.Sample
    @Test Sample.f()[pri:0, instance:com.selenium.linkcheck.Sample@1ac8e09]
  @BeforeClass Sample.setup(java.lang.String)[pri:0, instance:com.selenium.linkcheck.Sample@1a6c214]
  @AfterMethod Sample.screenshot()[pri:0, instance:com.selenium.linkcheck.Sample@1ac8e09]
    @Test Sample.f()[pri:0, instance:com.selenium.linkcheck.Sample@1a6c214]
  @AfterMethod Sample.screenshot()[pri:0, instance:com.selenium.linkcheck.Sample@1a6c214]
  @AfterClass Sample.afterClass()[pri:0, instance:com.selenium.linkcheck.Sample@1a6c214]
======
  @AfterClass Sample.afterClass()[pri:0, instance:com.selenium.linkcheck.Sample@1ac8e09]
======
[Invoker 2545894] Invoking @BeforeClass Sample.setup(java.lang.String)[pri:0, instance:com.selenium.linkcheck.Sample@1a6c214]
[Invoker 2545894] Invoking @BeforeClass Sample.setup(java.lang.String)[pri:0, instance:com.selenium.linkcheck.Sample@1ac8e09]
firefox
Failed to invoke configuration method com.selenium.linkcheck.Sample.setup:null value in entry: desiredCapabilities=null
===== Invoked methods
  Sample.setup(java.lang.String)[pri:0, instance:com.selenium.linkcheck.Sample@1ac8e09]iexplore  28085769
    Sample.f()[pri:0, instance:com.selenium.linkcheck.Sample@1ac8e09] 28085769
=====
Creating D:\Testing\Links CHecking\test-output\Same TestCases on Different Browser\Run on Internet Explorer.html
Creating D:\Testing\Links CHecking\test-output\Same TestCases on Different Browser\Run on Internet Explorer.xml
FAILED CONFIGURATION: @BeforeClass setup("iexplore")
java.lang.NullPointerException: null value in entry: desiredCapabilities=null
        at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:235)
        at com.google.common.collect.ImmutableMap.entryOf(ImmutableMap.java:144)
        at com.google.common.collect.ImmutableMap$Builder.put(ImmutableMap.java:182)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:209)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
        at com.selenium.linkcheck.Sample.setup(Sample.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
        at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
        at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
        at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
        at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107)
        at org.testng.TestRunner.privateRun(TestRunner.java:767)
        at org.testng.TestRunner.run(TestRunner.java:617)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
        at org.testng.SuiteRunner.access$000(SuiteRunner.java:37)
        at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:368)
        at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

SKIPPED CONFIGURATION: @AfterMethod screenshot
SKIPPED CONFIGURATION: @AfterClass afterClass
SKIPPED: f

===============================================
    Run on Internet Explorer
    Tests run: 1, Failures: 0, Skips: 1
    Configuration Failures: 1, Skips: 2
===============================================

Failed to invoke configuration method com.selenium.linkcheck.Sample.setup:Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.26.0', revision: '18041', time: '2012-11-01 19:33:38'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_07'
Driver info: driver.version: RemoteWebDriver
===== Invoked methods
  Sample.setup(java.lang.String)[pri:0, instance:com.selenium.linkcheck.Sample@1a6c214]firefox  27705876
    Sample.f()[pri:0, instance:com.selenium.linkcheck.Sample@1a6c214] 27705876
=====
Creating D:\Testing\Links CHecking\test-output\Same TestCases on Different Browser\Run on Firefox.html
Creating D:\Testing\Links CHecking\test-output\Same TestCases on Different Browser\Run on Firefox.xml
FAILED CONFIGURATION: @BeforeClass setup("firefox")
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.26.0', revision: '18041', time: '2012-11-01 19:33:38'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_07'
Driver info: driver.version: RemoteWebDriver
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:526)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:215)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
        at com.selenium.linkcheck.Sample.setup(Sample.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
        at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
        at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
        at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
        at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107)
        at org.testng.TestRunner.privateRun(TestRunner.java:767)
        at org.testng.TestRunner.run(TestRunner.java:617)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
        at org.testng.SuiteRunner.access$000(SuiteRunner.java:37)
        at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:368)
        at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:4444 refused
        at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)
        at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:151)
        at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:125)
        at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640)
        at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
        at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:329)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:300)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:505)
        ... 25 more
Caused by: java.net.ConnectException: Connection refused: connect
        at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
        at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:127)
        at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
        ... 33 more

SKIPPED CONFIGURATION: @AfterMethod screenshot
SKIPPED CONFIGURATION: @AfterClass afterClass
SKIPPED: f

===============================================
    Run on Firefox
    Tests run: 1, Failures: 0, Skips: 1
    Configuration Failures: 1, Skips: 2
===============================================


===============================================
Same TestCases on Different Browser
Total tests run: 2, Failures: 0, Skips: 2
Configuration Failures: 2, Skips: 4
===============================================


sample.java
import org.openqa.selenium.remote.RemoteWebDriver;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Calendar;

import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Parameters;
//import org.testng.annotations.AfterTest;
import org.testng.annotations.Test;

//import com.sun.jna.platform.FileUtils;

public class Sample {
        WebDriver driver;
        @Parameters ({"browser"} )
        @BeforeClass
        public void setup(String browser) throws MalformedURLException {
                DesiredCapabilities capability=null;
                       
                if(browser.equalsIgnoreCase("firefox")){
                        System.out.println("firefox");
                        capability= DesiredCapabilities.firefox();
                        capability.setBrowserName("firefox");
                        capability.setPlatform(org.openqa.selenium.Platform.ANY);
                        //capability.setVersion("");
                }
       
                if(browser.equalsIgnoreCase("googlechrome")){
                        System.out.println("googlechrome");
                        capability= DesiredCapabilities.chrome();
                        capability.setBrowserName("googlechrome");
                        capability.setPlatform(org.openqa.selenium.Platform.ANY);
                        //capability.setVersion("");
                }
               
                driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
                driver.navigate().to("http://google.com");
               
        }
       
       
   
        @Test
  public void f() {
          driver.get("https://www.google.com");
          String tel = driver.getTitle();
          System.out.println("page tiel"+ tel);
         
  }
  @AfterClass
  public void afterClass()
  {
  driver.close();}
 

testng.xml
<suite name="TestCases on Different Browser" verbose="3"  parallel="tests" thread-count="2">   
  <test name="Run on Internet Explorer">
        <parameter name="browser"  value="iexplore"/>
    <classes>
      <class name="com.selenium.linkcheck.Sample"/>
    </classes>
 </test> 

  <test name="Run on Firefox">
        <parameter name="browser"  value="firefox"/>
    <classes>
      <class name="com.selenium.linkcheck.Sample"/>
    </classes>
 </test> 
 </suite>
Reply | Threaded
Open this post in threaded view
|

Re: Parallel Execution with TestNG

softwaretestingforum
Administrator
I noticed that you set up parallel test execution for internet explorer also but there is no corresponding set up in you code -

if(browser.equalsIgnoreCase("firefox")){ 
                        System.out.println("firefox"); 
                        capability= DesiredCapabilities.firefox(); 
                        capability.setBrowserName("firefox"); 
                        capability.setPlatform(org.openqa.selenium.Platform.ANY); 
                        //capability.setVersion(""); 
                } 
        
                if(browser.equalsIgnoreCase("googlechrome")){ 
                        System.out.println("googlechrome"); 
                        capability= DesiredCapabilities.chrome(); 
                        capability.setBrowserName("googlechrome"); 
                        capability.setPlatform(org.openqa.selenium.Platform.ANY); 
                        //capability.setVersion(""); 
} 

b/w I am not sure how well support is for executing test in parallel on IE browser.
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: Parallel Execution with TestNG

anand_raja
I have changed the testng.xml to googlechrome, still having the same issue, Do i need to start chrome server? or not aware of it .


<suite name="Same TestCases on Different Browser" verbose="3"  parallel="tests" thread-count="2">   
  <test name="Run on Chrome">
        <parameter name="browser"  value="googlechrome"/>
    <classes>
      <class name="com.selenium.linkcheck.Sample"/>
    </classes>
 </test> 

  <test name="Run on Firefox">
        <parameter name="browser"  value="firefox"/>
    <classes>
      <class name="com.selenium.linkcheck.Sample"/>
    </classes>
 </test> 
 </suite>
Reply | Threaded
Open this post in threaded view
|

Re: Parallel Execution with TestNG

softwaretestingforum
Administrator
Yes you would have to set up system property for chrome driver server -

ChromeDriverService chromeDriverService = new ChromeDriverService.Builder()
							.usingDriverExecutable(
									new File("You chrome server location"))
							.usingAnyFreePort().build();
					chromeDriverService.start();
					driver = new ChromeDriver(chromeDriverService);
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: Parallel Execution with TestNG

anand_raja
Have set up the chrome driver as you guided, Still I'm facing the same issue, did i Miss anything in my code or testng.xml ?

Failed to invoke configuration method com.selenium.linkcheck.Sample.setup:Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.26.0', revision: '18041', time: '2012-11-01 19:33:38'
 

System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_07'
Driver info: driver.version: RemoteWebDriver
===== Invoked methods
  Sample.setup(java.lang.String)[pri:0, instance:com.selenium.linkcheck.Sample@469729]firefox  4626217
    Sample.f()[pri:0, instance:com.selenium.linkcheck.Sample@469729] 4626217
=====
Creating D:\Testing\Links CHecking\test-output\Same TestCases on Different Browser\Run on Firefox.html
Creating D:\Testing\Links CHecking\test-output\Same TestCases on Different Browser\Run on Firefox.xml
FAILED CONFIGURATION: @BeforeClass setup("firefox")
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.26.0', revision: '18041', time: '2012-11-01 19:33:38'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_07'
Driver info: driver.version: RemoteWebDriver
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:526)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:215)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
        at com.selenium.linkcheck.Sample.setup(Sample.java:58)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
        at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
        at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
        at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
        at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107)
        at org.testng.TestRunner.privateRun(TestRunner.java:767)
        at org.testng.TestRunner.run(TestRunner.java:617)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
        at org.testng.SuiteRunner.access$000(SuiteRunner.java:37)
        at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:368)
        at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:4444 refused
        at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)
        at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:151)
        at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:125)
        at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640)
        at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
        at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:329)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:300)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:505)
        ... 25 more


<suite name="Same TestCases on Different Browser" verbose="3"  parallel="tests" thread-count="2">   
  <test name="Run on Chrome ">
        <parameter name="browser"  value="googlechrome"/>
    <classes>
      <class name="com.selenium.linkcheck.Sample"/>
    </classes>
 </test> 

  <test name="Run on Firefox">
        <parameter name="browser"  value="firefox"/>
    <classes>
      <class name="com.selenium.linkcheck.Sample"/>
    </classes>
 </test> 
 </suite>

import java.io.File;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Calendar;

import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Parameters;
//import org.testng.annotations.AfterTest;
import org.testng.annotations.Test;

//import com.sun.jna.platform.FileUtils;

public class Sample {
        WebDriver driver;
        @Parameters ({"browser"} )
        @BeforeClass
        public void setup(String browser) throws IOException {
                DesiredCapabilities capability=null;
                       
                if(browser.equalsIgnoreCase("firefox")){
                        System.out.println("firefox");
                        capability= DesiredCapabilities.firefox();
                        capability.setBrowserName("firefox");
                        capability.setPlatform(org.openqa.selenium.Platform.ANY);
                       
        //driver = new ChromeDriver(chromeDriverService);
                        //capability.setVersion("");
                }
       
                if(browser.equalsIgnoreCase("googlechrome")){
                        System.out.println("googlechrome");
                        capability= DesiredCapabilities.chrome();
                        capability.setBrowserName("googlechrome");
                        capability.setPlatform(org.openqa.selenium.Platform.ANY);
                        ChromeDriverService chromeDriverService = new ChromeDriverService.Builder()
                        .usingDriverExecutable(
                                        new File("C://Program Files//Google//Chrome//Application//chrome.exe"))
                        .usingAnyFreePort().build();
        chromeDriverService.start();
        driver = new ChromeDriver(chromeDriverService);
                        //capability.setVersion("");
                }
               
                driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
                driver.navigate().to("http://google.com");
               
        }
       
       
   
        @Test
  public void f() {
          driver.get("https://www.google.com");
          String tel = driver.getTitle();
          System.out.println("page tiel"+ tel);
         
  }
  @AfterClass
  public void afterClass()
  {
  driver.close();}
 
 
 
  @AfterMethod
  public void screenshot() throws Exception {
     // WebDriver augmentedDriver = new Augmenter().augment(driver);
      Calendar calendar = Calendar.getInstance();
      //String userHome = System.getProperty("user.home");
      String screenShotsFolder = "\\Screenshots"; //
      System.out.println(screenShotsFolder);
      String className = this.getClass().getSimpleName();
      //String lastCall = null;
        String filename = screenShotsFolder + className + "_"
              + calendar.get(Calendar.YEAR) + "-"
              + calendar.get(Calendar.MONTH) + "-"
              + calendar.get(Calendar.DAY_OF_MONTH) + "-"
              + calendar.get(Calendar.HOUR_OF_DAY) + "-"
              + calendar.get(Calendar.MINUTE) + "-"
              + calendar.get(Calendar.SECOND) + "-"
              + calendar.get(Calendar.MILLISECOND) + ".png";
      File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
          try {
          FileUtils.copyFile(scrFile, new File(filename));
          System.out.println("myScreenshot1.png is generated go to directory to check");
      } catch (IOException e) {
          e.printStackTrace();
}
  }}

tarunkumar wrote
Yes you would have to set up system property for chrome driver server -

ChromeDriverService chromeDriverService = new ChromeDriverService.Builder()
							.usingDriverExecutable(
									new File("You chrome server location"))
							.usingAnyFreePort().build();
					chromeDriverService.start();
					driver = new ChromeDriver(chromeDriverService);
tarunkumar wrote
Yes you would have to set up system property for chrome driver server -

ChromeDriverService chromeDriverService = new ChromeDriverService.Builder()
							.usingDriverExecutable(
									new File("You chrome server location"))
							.usingAnyFreePort().build();
					chromeDriverService.start();
					driver = new ChromeDriver(chromeDriverService);
tarunkumar wrote
Yes you would have to set up system property for chrome driver server -

ChromeDriverService chromeDriverService = new ChromeDriverService.Builder()
							.usingDriverExecutable(
									new File("You chrome server location"))
							.usingAnyFreePort().build();
					chromeDriverService.start();
					driver = new ChromeDriver(chromeDriverService);
tarunkumar wrote
Yes you would have to set up system property for chrome driver server -

ChromeDriverService chromeDriverService = new ChromeDriverService.Builder()
							.usingDriverExecutable(
									new File("You chrome server location"))
							.usingAnyFreePort().build();
					chromeDriverService.start();
					driver = new ChromeDriver(chromeDriverService);
tarunkumar wrote
Yes you would have to set up system property for chrome driver server -

ChromeDriverService chromeDriverService = new ChromeDriverService.Builder()
							.usingDriverExecutable(
									new File("You chrome server location"))
							.usingAnyFreePort().build();
					chromeDriverService.start();
					driver = new ChromeDriver(chromeDriverService);
Reply | Threaded
Open this post in threaded view
|

Re: Parallel Execution with TestNG

softwaretestingforum
Administrator
I hope you are running hub on this - http://localhost:4444/wd/hub and nodes for firefox and chrome browser.
Configuration is described here - http://code.google.com/p/selenium/wiki/Grid2 
If every thing looks alright then I would suggest you to execute test with out using grid to make sure it works locally.
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: Parallel Execution with TestNG

anand_raja
org.openqa.selenium.WebDriverException: Error forwarding the new session Empty pool of VM for setup {platform=ANY, browserName=firefox, version=11.0}
Command duration or timeout: 350 milliseconds
Build info: version: '2.26.0', revision: '18041', time: '2012-11-01 19:33:38'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_07'
Driver info: driver.version: RemoteWebDriver

Can we execute parallel testing without using grid? is it possible to achieve  with TestNG and Selenium 2.0? If so you guide me with some example :)
Reply | Threaded
Open this post in threaded view
|

Re: Parallel Execution with TestNG

softwaretestingforum
Administrator
Yes definitely you can execute selenium test in parallel with out using grid. I guess I explained it in 4th or 5th session of Selenium training. You could download selenium session project from here -

http://manual-and-automated-testing.1070.n6.nabble.com/Selenium-Training-Project-for-9th-September-td5001466.html

I had used mercury tour site for selenium parallel testing example which seems down now but you should get an idea of how selenium tests can be executed in parallel.

 
~ seleniumtests.com