{"id":234075,"date":"2020-02-28T07:32:20","date_gmt":"2020-02-28T07:32:20","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=234075"},"modified":"2020-02-28T08:33:37","modified_gmt":"2020-02-28T08:33:37","slug":"getting-start-with-testng-selenium","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/","title":{"rendered":"Getting started with TestNG Selenium"},"content":{"rendered":"\n<p>TestNG is a testing framework sparked from JUnit and NUnit but advancing some new functionalities that make it more robust and easier to use. TestNG include all levels of tests: unit, functional, end-to-end, integration, etc., and it requires JDK 5 or higher.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">TestNG Features<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Supports Before and after annotations.<\/li><li>Parameterization of test methods.<\/li><li>Supports Data-Driven Testing using Data providers.<\/li><li>Test cases can be arranged and prioritized easily.<\/li><li>Supports threat safe environment when executing multiple threads.<\/li><li>Easily integrate with various tools and plug-ins like build tools (Ant, Jenkins, Maven etc.), Integrated Development Environment (Eclipse).<\/li><li>Facilitates user with effective means of Report Generation using ReportNG.<\/li><li>Support for multi-threaded testing.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong> Installation and Setup<\/strong><\/h2>\n\n\n\n<p>If you are using Eclipse IDE, it\u2019s very easy to install TestNG. Below are the steps to install TestNG.<\/p>\n\n\n\n<p><strong>Step 1:&nbsp;<\/strong>Launch eclipse IDE -&gt; Click on the Help option in the menu -&gt; Select \u201cEclipse Marketplace\u201d option in the dropdown.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"308\" height=\"421\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-3-1.png\" alt=\"Screenshot-3-1\" class=\"wp-image-235019\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-3-1.png 308w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-3-1-219x300.png 219w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-3-1-182x249.png 182w\" sizes=\"(max-width: 308px) 100vw, 308px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p><strong>Step 2:<\/strong>&nbsp;Enter  \u201cTestNG\u201d in the search field and click on the \u201cGo\u201d button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"615\" height=\"524\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-4-1.png\" alt=\"Screenshot-4-1\" class=\"wp-image-235025\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-4-1.png 615w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-4-1-300x256.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-4-1-250x213.png 250w\" sizes=\"(max-width: 615px) 100vw, 615px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p><strong>Step 3:<\/strong>&nbsp;Now, click on the Install button to install TestNG.<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"607\" height=\"562\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-5-1.png\" alt=\"Screenshot-5-1\" class=\"wp-image-235033\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-5-1.png 607w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-5-1-300x278.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-5-1-250x231.png 250w\" sizes=\"(max-width: 607px) 100vw, 607px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>So, After the Installation Eclipse would recommend you to restart in order to reflect the changes made. After restarting Eclipse, you can verify the TestNG installation. <\/p>\n\n\n\n<p>Go to Window-&gt;Preferences.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"453\" height=\"270\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-6-1.png\" alt=\"Screenshot-6-1\" class=\"wp-image-235047\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-6-1.png 453w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-6-1-300x179.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-6-1-250x149.png 250w\" sizes=\"(max-width: 453px) 100vw, 453px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"781\" height=\"548\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-7-1.png\" alt=\"Screenshot-7-1\" class=\"wp-image-235056\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-7-1.png 781w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-7-1-300x210.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-7-1-250x175.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-7-1-768x539.png 768w\" sizes=\"(max-width: 781px) 100vw, 781px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>TestNG: First Test<\/strong><\/h2>\n\n\n\n<p>Let us start with the creation of TestNG project.<\/p>\n\n\n\n<p><strong>Step 1:<\/strong>&nbsp;Click on the File option in the menu -&gt; Click on New -&gt; Select Java Project.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"550\" height=\"502\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-8.png\" alt=\"Screenshot-8\" class=\"wp-image-235059\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-8.png 550w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-8-300x274.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-8-250x228.png 250w\" sizes=\"(max-width: 550px) 100vw, 550px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p><strong>Step 2:<\/strong>&nbsp;Enter the project and click on the \u201cFinish\u201d button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"507\" height=\"602\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-9-1.png\" alt=\"Screenshot-9-1\" class=\"wp-image-235065\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-9-1.png 507w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-9-1-253x300.png 253w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-9-1-210x249.png 210w\" sizes=\"(max-width: 507px) 100vw, 507px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p><strong>Step 3:<\/strong>&nbsp;Configure the TestNG library inside the Java project. Go to  &#8220;Configure Build Path&#8221; -&gt; Click on the \u201cLibraries\u201d tab. Click on \u201cAdd library\u201d as shown below.<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"519\" height=\"451\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-10-1.png\" alt=\"Screenshot-10-1\" class=\"wp-image-235068\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-10-1.png 519w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-10-1-300x261.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-10-1-250x217.png 250w\" sizes=\"(max-width: 519px) 100vw, 519px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p><strong>Step 4:<\/strong>&nbsp;Now, select TestNG and click on the Next button. and, click on the Finish button.<\/p>\n\n\n\n<p>The TestNG is now added to the Java project. <\/p>\n\n\n\n<p><strong>NOTE:<\/strong> <em>Add all the JAR files inside the\u00a0<strong>selenium<\/strong>\u00a0and\u00a0<strong>libs<\/strong>\u00a0folders.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Creating TestNG File<\/h2>\n\n\n\n<p><strong>Step 1:<\/strong>&nbsp;Right-click the&nbsp;<strong>src<\/strong>&nbsp;folder of the Java Project and select&nbsp;New&nbsp;&gt;&nbsp;Other\u2026<\/p>\n\n\n\n<p>Select&nbsp;<strong>TestNG class<\/strong>&nbsp;and then click&nbsp;<strong>Next<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"618\" height=\"504\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/testngclass.png\" alt=\"testngclass\" class=\"wp-image-234270\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/testngclass.png 618w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/testngclass-300x245.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/testngclass-250x204.png 250w\" sizes=\"(max-width: 618px) 100vw, 618px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p><strong>Step 2:<\/strong> Now, enter the Source folder, package name and the TestNG class name. Here, we can also select multiple TestNG notations.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"622\" height=\"522\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-1-1.png\" alt=\"Screenshot-1-1\" class=\"wp-image-234275\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-1-1.png 622w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-1-1-300x252.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-1-1-250x210.png 250w\" sizes=\"(max-width: 622px) 100vw, 622px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>Click&nbsp;<strong>Finish<\/strong>. The template for your first TestNG file will be created with the default schema<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import org.testng.annotations.Test;\nimport org.testng.annotations.BeforeTest;\nimport org.testng.annotations.AfterTest;\n\npublic class NewTest {\n  @Test\n  public void f() {\n  }\n  @BeforeTest\n  public void beforeTest() {\n  }\n\n  @AfterTest\n  public void afterTest() {\n  }\n\n}<\/pre>\n\n\n\n<p>The&nbsp;<code>@Test<\/code>&nbsp; annotation is the root of TestNG test cases, tells that the method under it is a &#8216;test case&#8217;. Here, the method&nbsp;<code>f<\/code>&nbsp;is a test case. <\/p>\n\n\n\n<p>The&nbsp;<code>@BeforeTest<\/code>&nbsp;annotation tells that the method under it will be executed before the first test case. The&nbsp;<code>@AfterTest<\/code>&nbsp;annotation tells that the method under it will be executed after the last test case.<\/p>\n\n\n\n<p>Let\u2019s now code an actual test code. In the following code snippet, we will be&nbsp;<strong>automating the sign-up flow<\/strong>&nbsp;using annotations.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import org.testng.annotations.Test;\nimport org.testng.annotations.BeforeMethod;\nimport org.testng.annotations.AfterMethod;\nimport org.testng.annotations.BeforeClass;\n\nimport java.util.concurrent.TimeUnit;\n\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.chrome.ChromeDriver;\nimport org.testng.annotations.AfterClass;\n\npublic class NewTest {\n\nWebDriver driver;\n\n@BeforeClass\npublic void testSetup()\n{\nSystem.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;.\\\\Driver\\\\chromedriver.exe&quot;);\ndriver=new ChromeDriver();\ndriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);\ndriver.manage().window().maximize();\n\n}\n\n@BeforeMethod\npublic void openBrowser()\n{\ndriver.get(&quot;https:\/\/example.com\/&quot;);\ndriver.findElement(By.id(&quot;signup&quot;)).click();\nSystem.out.println(&quot;We are currently on the following URL&quot; +driver.getCurrentUrl());\n}\n\n@Test(description=&quot;This method validates the sign up functionality&quot;)\npublic void signUp()\n{\ndriver.findElement(By.id(&quot;fullname&quot;)).sendKeys(&quot;John Doe&quot;);\ndriver.findElement(By.id(&quot;emailid&quot;)).sendKeys(&quot;johndoe@webkul.com&quot;);\ndriver.findElement(By.id(&quot;password&quot;)).sendKeys(&quot;demo123&quot;);\ndriver.findElement(By.id(&quot;submit&quot;)).click();\n\n}\n\n@AfterMethod\npublic void postSignUp()\n{\nSystem.out.println(driver.getCurrentUrl());\n\n}\n\n@AfterClass\npublic void afterClass()\n{\ndriver.quit();\n}\n\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Execute the TestNG script<\/strong><\/h2>\n\n\n\n<p>In order to run the test, follow the below steps:<\/p>\n\n\n\n<p>Right-click the&nbsp;NewTest&nbsp;folder and Select&nbsp;<strong>Run as<\/strong>&nbsp;&gt;&nbsp;<strong>TestNG Test<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"478\" height=\"474\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-11.png\" alt=\"Screenshot-11\" class=\"wp-image-235079\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-11.png 478w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-11-300x297.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-11-250x249.png 250w\" sizes=\"(max-width: 478px) 100vw, 478px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>The results of the test will be displayed into two windows the console window and in the TestNG results window:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"616\" height=\"238\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-5.png\" alt=\"Screenshot-5\" class=\"wp-image-234809\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-5.png 616w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-5-300x116.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-5-250x97.png 250w\" sizes=\"(max-width: 616px) 100vw, 616px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"963\" height=\"298\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-1-2.png\" alt=\"Screenshot-1-2\" class=\"wp-image-234817\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-1-2.png 963w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-1-2-300x93.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-1-2-250x77.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-1-2-768x238.png 768w\" sizes=\"(max-width: 963px) 100vw, 963px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>To generate the HTML report<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>Right-click the&nbsp;<strong>Project<\/strong> and select&nbsp;<strong>Refresh<\/strong>. A test-output folder will be created:<a href=\"https:\/\/docs.mendix.com\/howto\/testing\/attachments\/18448634\/18580382.png\"><\/a><\/li><li>Open the&nbsp;<strong>test-output<\/strong>&nbsp;folder.<\/li><li>Open on the \u201cemailable-report.html\u201d file<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"791\" height=\"384\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-2-1.png\" alt=\"Screenshot-2-1\" class=\"wp-image-234829\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-2-1.png 791w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-2-1-300x146.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-2-1-250x121.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-2-1-768x373.png 768w\" sizes=\"(max-width: 791px) 100vw, 791px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>This is all about creating a TestNG test file, and to create a test suite and to run the automated test using TestNG.<\/p>\n\n\n\n<p>Thanks for reading this blog \ud83d\ude42<\/p>\n\n\n\n<p>Happy testing!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>TestNG is a testing framework sparked from JUnit and NUnit but advancing some new functionalities that make it more robust and easier to use. TestNG include all levels of tests: unit, functional, end-to-end, integration, etc., and it requires JDK 5 or higher.&nbsp; TestNG Features Supports Before and after annotations. Parameterization of test methods. Supports Data-Driven <a href=\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":254,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4312,5847,3137,5848,4932],"tags":[2273,3138,3250,5849,4903],"class_list":["post-234075","post","type-post","status-publish","format-standard","hentry","category-automation-testing","category-selenium","category-testing","category-testng","category-web-testing","tag-automation","tag-selenium","tag-testing","tag-testng","tag-web-testing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Getting started with TestNG Selenium - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting started with TestNG Selenium - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"TestNG is a testing framework sparked from JUnit and NUnit but advancing some new functionalities that make it more robust and easier to use. TestNG include all levels of tests: unit, functional, end-to-end, integration, etc., and it requires JDK 5 or higher.&nbsp; TestNG Features Supports Before and after annotations. Parameterization of test methods. Supports Data-Driven [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-02-28T07:32:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-02-28T08:33:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-3-1.png\" \/>\n<meta name=\"author\" content=\"Priya Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Priya Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/\"},\"author\":{\"name\":\"Priya Singh\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/851e395b5e31e900911279abd4fb70a2\"},\"headline\":\"Getting started with TestNG Selenium\",\"datePublished\":\"2020-02-28T07:32:20+00:00\",\"dateModified\":\"2020-02-28T08:33:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/\"},\"wordCount\":597,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-3-1.png\",\"keywords\":[\"Automation\",\"Selenium\",\"testing\",\"TestNG\",\"Web testing\"],\"articleSection\":[\"Automation testing\",\"Selenium\",\"Testing\",\"TestNG\",\"Web testing\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/\",\"url\":\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/\",\"name\":\"Getting started with TestNG Selenium - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-3-1.png\",\"datePublished\":\"2020-02-28T07:32:20+00:00\",\"dateModified\":\"2020-02-28T08:33:37+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-3-1.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-3-1.png\",\"width\":308,\"height\":421,\"caption\":\"Screenshot-3-1\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Getting started with TestNG Selenium\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/851e395b5e31e900911279abd4fb70a2\",\"name\":\"Priya Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b16cffb90ba0c063de5549b25325147813a6bf679df37cf743953840ef8ed016?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b16cffb90ba0c063de5549b25325147813a6bf679df37cf743953840ef8ed016?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"caption\":\"Priya Singh\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/priyasingh-tester617\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Getting started with TestNG Selenium - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/","og_locale":"en_US","og_type":"article","og_title":"Getting started with TestNG Selenium - Webkul Blog","og_description":"TestNG is a testing framework sparked from JUnit and NUnit but advancing some new functionalities that make it more robust and easier to use. TestNG include all levels of tests: unit, functional, end-to-end, integration, etc., and it requires JDK 5 or higher.&nbsp; TestNG Features Supports Before and after annotations. Parameterization of test methods. Supports Data-Driven [...]","og_url":"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2020-02-28T07:32:20+00:00","article_modified_time":"2020-02-28T08:33:37+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-3-1.png","type":"","width":"","height":""}],"author":"Priya Singh","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Priya Singh","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/"},"author":{"name":"Priya Singh","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/851e395b5e31e900911279abd4fb70a2"},"headline":"Getting started with TestNG Selenium","datePublished":"2020-02-28T07:32:20+00:00","dateModified":"2020-02-28T08:33:37+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/"},"wordCount":597,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-3-1.png","keywords":["Automation","Selenium","testing","TestNG","Web testing"],"articleSection":["Automation testing","Selenium","Testing","TestNG","Web testing"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/","url":"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/","name":"Getting started with TestNG Selenium - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-3-1.png","datePublished":"2020-02-28T07:32:20+00:00","dateModified":"2020-02-28T08:33:37+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-3-1.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-3-1.png","width":308,"height":421,"caption":"Screenshot-3-1"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/getting-start-with-testng-selenium\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Getting started with TestNG Selenium"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/851e395b5e31e900911279abd4fb70a2","name":"Priya Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b16cffb90ba0c063de5549b25325147813a6bf679df37cf743953840ef8ed016?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b16cffb90ba0c063de5549b25325147813a6bf679df37cf743953840ef8ed016?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","caption":"Priya Singh"},"url":"https:\/\/webkul.com\/blog\/author\/priyasingh-tester617\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/234075","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/254"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=234075"}],"version-history":[{"count":27,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/234075\/revisions"}],"predecessor-version":[{"id":235703,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/234075\/revisions\/235703"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=234075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=234075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=234075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}