Category: TestNG

Create TestNg Test using Playwright Java

In this blog we will be utilizing Playwright Java to create a TestNg Test. Topics that we will cover: Add TestNG maven dependency Create TestNG test Source code Add TestNG maven dependency We start by adding TestNg dependency in pom.xml Navigate to below site  https://mvnrepository.com/artifact/org.testng/testng    Paste in pom.xml file  Note: The dependency (see below) […]

Groups attribute in TestNG

Include groups at test tag level Exclude groups at test tag level Include groups at test tag level Let us now see how to group @Tests using groups attribute in TestNG. Let us create ‘LoginUser’ class under below package Add 5 @Test methods Add groups={“smoke”} for first and third @Test, see below Let all 5 […]

Priority attribute in TestNG

Default execution order of @Test methods Priority attribute usage Priority = 0 Priority = -1 (negative priority) Same priority to all test methods Default execution order of @Test methods  Ensure that you have TestNG installed.  If TestNG is not installed, than perform following steps: Help > Eclipse Marketplace…  Enter Testng in search field as shown […]

TestNG Annotations

1. TestNg annotation: @BeforeTest2. TestNg annotation: @AfterTest3. TestNg annotation: @BeforeSuite4. TestNg annotation: @AfterSuite5. TestNg annotation: @BeforeMethod6. TestNg annotation: @AfterMethodTestNg annotation: @BeforeTest Let’s say, before you run any test case, there is a pre-requisite to clean the data that you have created in the database. This can be achieved using @BeforeTest. Thus, @BeforeTest annotation would be […]

TestNG Interview Questions

Table of Contents 1. What is TestNG? 2. Mention some of the Advantages of TestNG? 3. Explain the difference between Test and Test Suite in TestNG. 4. Why should we use TestNG in Selenium Framework? 5. How to add TestNG maven dependency in POM.xml? 6. What is TestNG.XML File? 7. What is annotation in TestNG? […]

TestNG Groups: Include, Exclude with Example – Selenium Tutorial

TestNG is a Testing framework that covers different types of test designs like unit, functional, end to end, UI and integration test. You can run a single or multiple packages (package here means to encapsulate a group of classes in a proper director format) by creating XML and run it through maven. table of contents […]

TestNG @Test Priority in Selenium

TestNG is a Testing framework, that covers different types of test designs like a unit test, functional test, end to end test, UI test and integration test. You can run a single or multiple test cases in your Testng code. If test priority is not defined while, running multiple test cases, TestNG assigns all @Test […]

How to Download & Install TestNG in Eclipse for Selenium WebDriver

Following is a step by step guide to install TestNG in Eclipse Installing TestNG in Eclipse Step 1) Launch Eclipse. On the menu bar, click Help. Choose the “Install New Software…” option. Step 2) In the Eclipse Install dialog box Enter “http://dl.bintray.com/testng-team/testng-eclipse-release/” in the Work with box Click the Add button. Step 3) In Add repository dialog […]

TestNG Annotations, Framework, Examples in Selenium

table of contents What is TestNG? Why Use TestNG with Selenium? Advantages of TestNG over JUnit Create Test Case Using TestNG Annotations How to Create a New TestNG Test File Coding of our First TestNG Test Case Example Running the Test Generating HTML Reports Annotations used in TestNG Multiple Test Cases Parameters Summary of TestNG […]