Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
TestNG Articles - Page 4 of 8
393 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. Test cases can be grouped more easily. Parallelization of tests can be achieved using TestNG. Support for data−driven testing. Inbuilt reporting. Selenium Webdriver allows to interact with webpages. It is an interface not a testing framework. To run any test or code only in selenium we must use java main method. TestNG ... Read More
543 Views
TestNG supports to group the test cases based on similar functionality or uses. Sometimes user has customized conditions to pick classes/methods/groups at run time based on conditions and use cases. TestNG supports simple frequently use scenarios but covering all expects are unnecessary. For Example, user may add multiple groups to single test. While running the group using syntax, TestNG runs all tests those are part of the group. It works as OR statement. Like if a test has 2 groups and only 1 is mentioned in tag it will run the test. But, when user wants ... Read More
1K+ Views
A TestNG class can have different tests like test1, test2, test3 etc. There could be some failure while running the test suite and user may get failures in between of @Test methods. Once a test method gets failed, he wants to continue the execution so all failures can be found out at the time. By default, if a failure occurs in a @Test method, TestNG gets exit from the same @Test method and continue the execution from next @Test method. Here, the use case is to continue the execution of next line even if an assertion failed in same @Test ... Read More
585 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 at include, exclude and package tags. Following are few ways those are handy to use regular expression in a test class run from a test suite. Mention all class names inside . And, inside the class use and . It will exclude all tests starting with name ... Read More
9K+ Views
Software Testing is an important phase in the software development lifecycle because it involves locating and identifying bugs in the programme as well as ensuring that the software is error free. Testing is analogous to "quality control" and is what guarantees quality in the development of software. Unit testing, integration testing, functional testing, performance testing, acceptance testing, etc., are just some of the many types of testing that are performed at various points throughout the process.Unit testing is carried out concurrently with the coding of a computer programme or application. In this type of testing, the smaller, more easily testable ... Read More
3K+ Views
TestNG supports native dependency injection. It allows to declare additional parameters in methods. At the runtime, TestNG automatically fills these parameters with the right values. Here is a list of some native dependencies in TestNG:ITestContextXmlTestMethodITestResultYou can use these dependencies to get the execution status of a test in TestNG.Usually, @AfterMethod supports all these native dependencies and the test status could be either Success, Failure or Skip.TestNG supports the following test status that can be retrieved by calling the function at the right place.org.testng.ITestResultpublic static final intFAILURE2public static final intSKIP3public static final intSTARTED16public static final intSUCCESS1public static final intSUCCESS_PERCENTAGE_FAILURE4In this article, ... Read More
1K+ Views
TestNG supports a lot of assertions. It has the org.testng.Assert class that extends the Java object class java.lang.object.Whenever there is a failure, a user would want to get a detailed failure report in order to perform a root cause analysis. But, sometimes the displayed failure information is not sufficient and sometimes the user is supplied with the same type of failure information repeated every time. These kinds of issues can be handled in TestNG using the keyword verbose ="".TestNG supports verbose and allows the user to pass a value based on the extent of failure information they want to see. ... Read More
13K+ Views
testNG.xml is very flexible and it can work as a harness file to execute the test cases. It keeps the development and execution separate from each other. A user can develop "N" number of test cases in testNG but can run a limited number of test methods based on the configuration in testNG.xml.In this article, let's see how to run only one test method from a large TestNG suite.To run only one test method, we will use the 'include' keyword from TestNG. In testNG.xml, first we will define the class name where the method is present and after that mention ... Read More
567 Views
TestNG allows to run the test suites from IntelliJ IDE as well as from the command line. When user runs the testNG.xml either from an IDE or the command line, TestNG generates a default report. It saves all the reports and respective HTML files in the Project->test-output folder. If this folder does not exist, then TestNG creates one.To disable the default reports programmatically, TestNG should be run through the command line (cmd).Following are the prerequisites to run the test suites from the command line −testNG.xml file should be created to define the test suites and testing classes to execute.All the ... Read More
7K+ Views
TestNG supports multiple ways to skip or ignore a @Test execution. Based on requirement, a user can skip a complete test without executing it at all or skip a test based on a specific condition. If the condition meets at the time of execution, it skips the remaining code in the test.Following are the ways to skip a @Test execution −Use the parameter enabled=false at @Test. By default, this parameter is set as True.Use throw new SkipException(String message) to skip a test.Conditional Skip − The user can have a condition check. If the condition is met, it will throw SkipException ... Read More