title: How to execute tests 50/50 parallel in Selenium Grid
body: <p>I have a selenium Grid 3 Set up.
  And right now i have 1 hub + 2 nodes. ( 1 local node, one external node).
  When i run my test it executes it on local node ( opens 3 browser).</p>
  
  <p>How and where i should set up test execution? If i want to run all tests on 2 browsers, or if i want to run 50/50 tests on 2 browsers?
  I will Attached my existing code below. </p>
  
  <pre><code>package com.ParallelTest;
  
  
          import org.openqa.selenium.chrome.ChromeDriver;
          import org.testng.annotations.BeforeClass;
          import org.testng.annotations.Parameters;
  
          import java.io.File;
          import java.net.MalformedURLException;
          import java.net.URL;
          import java.util.concurrent.TimeUnit;
  
          import org.openqa.selenium.Platform;
          import org.openqa.selenium.WebDriver;
          import org.openqa.selenium.remote.DesiredCapabilities;
          import org.openqa.selenium.remote.RemoteWebDriver;
          import org.testng.annotations.AfterClass;
  
  public class Framework {
      protected WebDriver driver;
  
      @Parameters({ "platform","browser","version", "url" })
      @BeforeClass(alwaysRun=true)
      public void setup(String platform, String browser, String
              version, String url) throws MalformedURLException
      {
          driver = getDriverInstance(platform, browser, version, url);
  
      }
  
      public static WebDriver getDriverInstance(String platform, String browser, String version, String url)
              throws MalformedURLException {
          String nodeURL = null;
  
  *// IS this should be a Node or Hub path? Because right now it`s a node path. But if i want to use 2 different nodes? How i can implement it????*
          String nodeURL = "http://10.11.161.249:5555/wd/hub";
          WebDriver driver = null;
          DesiredCapabilities caps = new DesiredCapabilities();
  
          // Platforms
          if (platform.equalsIgnoreCase("Windows")) {
              caps.setPlatform(Platform.WINDOWS);
  
  
          }
          if (platform.equalsIgnoreCase("MAC")) {
              caps.setPlatform(Platform.MAC);
  
          }
          // Browsers
          if (browser.equalsIgnoreCase("chrome")) {
              caps = DesiredCapabilities.chrome();
              System.setProperty("webdriver.chrome.driver", "/Users/antonfiliptsov/Desktop/Grid/ChromeDriver/chromedriver");
          }
          if (browser.equalsIgnoreCase("firefox")) {
              caps = DesiredCapabilities.firefox();
              System.setProperty("webdriver.gecko.driver","/Users/antonfiliptsov/Desktop/Grid/Firefox/geckodriver");
  
          }
          if (browser.equalsIgnoreCase("safari")){
              caps = DesiredCapabilities.safari();
          }
  
          // Version
          caps.setVersion(version);
          driver = new RemoteWebDriver(new URL(nodeURL), caps);
          // Maximize the browser's window
          // driver.manage().window().maximize();
          driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
          // Open the Application
          driver.get(url);
          return driver;
      }
  
      @AfterClass
      public void afterClass() {
          driver.quit();
      }
  }
  </code></pre>
  
  <p>Here is my TestNG File </p>
  
  <pre><code>&lt;suite name="TestSuite" parallel="tests"&gt;
      &lt;test name="FireFox Test"&gt;
          &lt;parameters&gt;
              &lt;parameter name="platform" value="MAC" /&gt;
              &lt;parameter name="browser" value="firefox" /&gt;
              &lt;parameter name="version" value="50.1.0" /&gt;
              &lt;parameter name="url" value="https://google.com" /&gt;
          &lt;/parameters&gt;
          &lt;classes&gt;
              &lt;class name="com.test"&gt;
              &lt;/class&gt;
          &lt;/classes&gt;
      &lt;/test&gt;
      &lt;test name="Chrome Test"&gt;
          &lt;parameters&gt;
              &lt;parameter name="platform" value="MAC" /&gt;
              &lt;parameter name="browser" value="chrome" /&gt;
              &lt;parameter name="version" value="55.0.2883.87" /&gt;
              &lt;parameter name="url" value="https://google.com" /&gt;
          &lt;/parameters&gt;
          &lt;classes&gt;
              &lt;class name="com.test"&gt;
              &lt;/class&gt;
          &lt;/classes&gt;
      &lt;/test&gt;
  &lt;test name="Chrome Test 1"&gt;
  &lt;parameters&gt;
      &lt;parameter name="platform" value="MAC" /&gt;
      &lt;parameter name="browser" value="chrome" /&gt;
      &lt;parameter name="version" value="55.0.2883.87" /&gt;
      &lt;parameter name="url" value="https://google.com" /&gt;
  &lt;/parameters&gt;
  &lt;classes&gt;
      &lt;class name="com.test"&gt;
      &lt;/class&gt;
  &lt;/classes&gt;
  &lt;/test&gt;
  
  &lt;/suite&gt;
  </code></pre>
  
  <p>In my test i have <strong>String nodeURL = "<a href="http://10.11.161.249:5555/wd/hub" rel="nofollow noreferrer">http://10.11.161.249:5555/wd/hub</a>";</strong>
  Which points my test for specific node, but how i can set up test pointing to to different node, or running parallel on 2 nodes? </p>