Ashish Anand has Published 213 Articles

What are Default Listeners in TestNG?

Ashish Anand

Ashish Anand

Updated on 04-Mar-2024 13:34:16

157 Views

TestNG Listeners have the capacity to listen to a specific incident. It is basically an interface that changes the nature of the system. TestNG Listeners are used for logging purposes and creating reports. TestNG can be configured with the Listeners which can change the default behavior of the TestNG. ... Read More

How to Download the Latest TestNG Jar File?

Ashish Anand

Ashish Anand

Updated on 21-Aug-2023 12:53:44

782 Views

TestNG is an open−source automation testing framework. It can be used along with build tool such as maven, Gradle, ant and even with snapshot. However, user can separately download the TestNG jar file and configure it with the project without using build tool. In this article, we will see how ... Read More

How do I Run Classes with TestNG by Name and Wildcard in testng.xml?

Ashish Anand

Ashish Anand

Updated on 21-Aug-2023 12:52:17

140 Views

testng.xml has a format as where we define what all test classes should be executed. There is no any specific way to provide regular expression in a class in . But there are work arounds those are useful to run specific @Test from a class. TestNG supports regular expression ... Read More

Why to use Selenium with TestNG?

Ashish Anand

Ashish Anand

Updated on 21-Aug-2023 12:49:53

120 Views

TestNG is a powerful testing framework, an enhanced version of JUnit which was in use for a long time before TestNG came into existence. NG stands for 'Next Generation'. TestNG framework provides the following features − Annotations help us organize the tests easily. Flexible test configuration. Multiple test ... Read More

Why does TestNG Allow Several Expected Exceptions?

Ashish Anand

Ashish Anand

Updated on 21-Aug-2023 12:45:28

98 Views

TestNG supports multiple exceptions in single @Test method. It is similar to the catch exception in Java where user can mention multiple exception class those are possible to be thrown. Ex: Syntax in catch exception is: catch(IOException | InterruptedException ex) { Similarly, syntax in TestNG is: @Test(expectedExceptions={NullPointerException.class, IllegalArgumentException.class }) public ... Read More

What is the Best Practice to Skip a Test in TestNG?

Ashish Anand

Ashish Anand

Updated on 21-Aug-2023 11:44:27

155 Views

TestNG supports multiple ways to skip or ignore a @Test execution. Based on requirement, user can skip a complete test without executing it at all or skip a test based on specific condition. If condition meets at the time of execution, it skips remaining code in the test. There are ... Read More

What is TestNG ERROR – Cannot find Class in Classpath?

Ashish Anand

Ashish Anand

Updated on 21-Aug-2023 11:42:34

547 Views

User may encounter Cannot find class in classpath exception while executing tests in TestNG framework. The meaning of this error is TestNG unable to find the class as mentioned in testng.xml. This can be caused because of the following reasons − In the TestNG XML, the class tag having ... Read More

What is Difference Detween assertEquals() vs assertTrue() in TestNG

Ashish Anand

Ashish Anand

Updated on 21-Aug-2023 11:41:08

360 Views

TestNG supports Assertion class that is used for validation. assertTrue() and assertEquals() are supported functions of this class. assertEquals() This function is used to assert whether 2 data values are equal or not. Data types can be used to assert are String, int, Boolean etc. The user should make sure ... Read More

What are TestNG and JUnit Frameworks in Selenium?

Ashish Anand

Ashish Anand

Updated on 21-Aug-2023 11:38:42

111 Views

JUnit and TestNG are the most popular testing frameworks for Java applications or Selenium. Both frameworks are easy to use. So, when it comes to choose the testing framework for your application, it’s better to have a high−level idea of what features are present in one or the other and ... Read More

How to use TestNG @After Annotation?

Ashish Anand

Ashish Anand

Updated on 21-Aug-2023 11:37:06

125 Views

A TestNG class can have various @After TestNG methods. Such as: @AfterTest @AfterSuite @AfterClass @AfterMethod etc. This article will explain the order of execution of different TestNG methods. TestNG consists of following @After methods to support main @Test method. The order of execution of @After methods should be as following: ... Read More

1 2 3 4 5 ... 22 Next
Advertisements