HOW TO EXECUTE SELENIUM WEBDRIVER TEST CASES PARALLEL IN MULTIPLE BROWSER USING TESTNG PARAMETER ANNOTATION

Pre-Requisite:
I am supposing that you are familiar with how to add jar files to your project and How to add any  class, folder and xml.
Most of the time we find it hard to do compatibility testing of certain web-page on various Browsers and it takes a big chunk of time for its execution on various set of Browser and also on various instance of Browser.
Testng has provided us an option through its Parameter feature, through which we could run same test script written in WebDriver  parallel to all our installed Browser on our system.
Scripts and Steps to execute Script 
1- Go to your Eclipse Project –> Right Click on Project –> Click On New–> others–> Pop up would appear–> Click on XML –> Select XML File –> Click on Next –> New XML File pop up would appear–> Enter the name of XML and click on Finish
2- Your XML file would appear like this
  <?xml version=“1.0” encoding=“UTF-8”?><suite name=“Suite_2” parallel=“tests”><test name=“Funaction Test Cases “><parameter name=“browser” value=“Chrome” /><classes><class name=“com.testng.Test” /></classes></test> <!– Test –>
<test name=“Funaction Test Cases_Firefox “><parameter name=“browser” value=“Firefox” /><classes><class name=“com.testng.Test” /></classes></test>
<test name=“Funaction Test Cases_IE “><parameter name=“browser” value=“IE” /><classes><class name=“com.testng.Test” /></classes></test>
</suite> <!– Suite –>
Download xml file from here
Now understand the tags of XML that I have marked Bold in XML file
Parallel:  this is being used to run tests parallely in different browser
suite name: This is the name of your test suit
test name : kind of test cases (you may give name like this Regression, Sanity,Smoke, or any thing that make you to make better test execution ) like i have given name to this test case as Generic test
Classes: name of class that you want to add in this test execution
Most important one is
Here browser has been taken as parameter name(you can give name as per you choice) and FF for Firefox,IE for Internet Explorer, and Chrome for Chrome Browser are the various values given to this browser parameter that would be called in our code.
3- Now its time to understand how you have to use parameter name in Java program. Since parameter is defined for Browsers. Since you are trying to use Testng framework we would  write two function first one to launch Browser and Second one to close Browser
Create new java class in your Java Project
Steps to create new java class:: right click on project ||New|| Click on Class||Enter the name of class and Hit on finish.
Name of my java class is Browser.java so just create one class with name Browser and copy and paste following code in eclipse.
But before moving ahead i would suggest to go through following two post
4- Since we have created Browser class in which we have used the parameter defined in XML, Now we should create one more class that is our Test class, This class would inherit Browser class for launching Browser before executing scripts under @Test annotation and for Closing Browser once execution of scipt under @Test annotation get completed.here I have given the name of this class is Test
5- Now its time to execute Test-Case
Steps:Right Click on Test.java file and –> Run As –> Run Confinguration –> In pop up Go Testng –> Right Click on Testng and Click on New –> Give name to your Run Configuration, Browser Class and select your Xml just by Browsing in front of Suit –> hit on Finish and this would run your test
TestNg-ConfigHope this post would help you to run parallel WebDriver test case .
Friends I have tried these scripts on my system and are running well so if you find any missing bracket or braces missing then please do the correction at your own but Script is correct.