Invoke JUnit Test Cases in TestNG

Ashish Anand
Updated on 18-Aug-2023 11:38:01

492 Views

TestNG can automatically recognize and run JUnit tests, so that you can use TestNG as a runner for all your existing tests and write new tests using TestNG. All you must do is to put JUnit library on the TestNG classpath, so it can find and use JUnit classes, change your test runner from JUnit to TestNG in Ant, and then run TestNG in "mixed" mode. This way, you can have all your tests in the same project, even in the same package, and start using TestNG. This approach also allows you to convert your existing JUnit tests to TestNG ... Read More

TestNG Listener to List All Groups of a Test Method

Ashish Anand
Updated on 18-Aug-2023 11:36:03

239 Views

A TestNG class can have different tests like test1, test2, test3 etc. and these tests can be grouped based on different groups like unit, integration or both or any bug number. User may want to run the @Test method based on groups. And, it is always convenient to know which test method belongs to which group so that these details can be included into report. TestNG supports multiple ways to get group name at run time such as injection dependency and Listeners are most popular. Even in Listeners it can be achieved using ITestListener or IInvokedMethodListener. In this article, let’s ... Read More

Difference Between Voltage Drop and Potential Difference

Manish Kumar Saini
Updated on 18-Aug-2023 11:34:55

7K+ Views

While analyzing electric circuits, we come across the electrical quantities "voltage drop" and "potential difference" that appear to be the same at first sight because both are measured in Volts. In this article, we will highlight how Voltage Drop is different from Potential Difference in many aspects. Before discussing the differences between Voltage Drop and Potential Difference, let's start with some basics so that it becomes easy to understand the differences between them. What is Voltage Drop? When an electric current flows through a circuit and there is a drop or decrease in the electric potential of the charge ... Read More

Generate All Permutations of a String with Given Constraints

Sonal Meenu Singh
Updated on 18-Aug-2023 11:31:47

517 Views

Introduction In this tutorial, we implement two examples using C++ programming concepts to generate all permutations of an input string. Permutation of a string is the number of ways a string can be arranged by interchanging the position of characters. We also include some constraints or limitations. All permutations or arrangements of the input string ensure character B does not follow character A anywhere, meaning there is no AB combination in the string. To implement this task we use two approaches: Directly generate all combinations of the string while restricting AB. Using backtracking. Demonstration 1 String = ... Read More

Capitalize the First and Last Character of Each Word in a String

Sonal Meenu Singh
Updated on 18-Aug-2023 11:28:04

580 Views

Introduction In this tutorial, we implement an approach to capitalizing the first and last characters of each word in the input string. By iterating over the input string str, each word's starting and ending letters are capitalized. We implement this problem using C++ programming in two ways. Let's start this tutorial with some demonstrations. Demonstration 1 String = “coding world” Output CodinG WorlD In the above demonstration, consider the input string and the result after capitalizing the starting and ending character of each word of the string is CodinG WorlD. Demonstration 2 String = “`hello all” ... Read More

TestNG Listener to Fetch Name of Executing Test Method

Ashish Anand
Updated on 18-Aug-2023 11:23:48

264 Views

A TestNG class can have different tests like test1, test2, test3 etc. and these tests can be grouped based on different groups like unit, integration or both or any bug number. User may want to run the @Test method based on groups. And, it is always convenient to know which test method belongs to which group so that these details can be included into report. TestNG supports multiple ways to get test name at run time such as injection dependency and Listeners are most popular. Even in Listeners it can be achieved using ITestListener or IInvokedMethodListener. In this article, let’s ... Read More

Difference Between Motor and Generator

Manish Kumar Saini
Updated on 18-Aug-2023 11:18:55

6K+ Views

The conversion of mechanical energy into electrical energy and electrical energy into mechanical energy is a necessary process in the industries as well as in our daily life. Electrical machines are used for the conversion of electrical energy into mechanical energy and mechanical energy into electrical energy.Depending upon the type of electromechanical energy conversion, the electrical machines are divided in two types as, Electric MotorElectric GeneratorIn this article, we will explain the key differences between electric motor and electric generator. We also added a brief description of the motor and generator for your reference.What is an Electric Motor?An electromechanical energy ... Read More

Stop Suite Execution After First Failure in TestNG

Ashish Anand
Updated on 18-Aug-2023 11:17:10

401 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, it skip remaining code of the @Test method and moves to the next @Test method. However, user may want to skip remaining all @Test methods after getting 1st failure. There are 2 most popular solution for such use cases: Write dependsOnMethods annotation – But this solution works only if user knows exact dependent method/s otherwise in large suite it would be ... Read More

Use Selenium with TestNG

Ashish Anand
Updated on 18-Aug-2023 11:08:30

603 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 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 provides ... Read More

Best Practices of Selenium Web Test Automation Framework

Ashish Anand
Updated on 18-Aug-2023 11:06:38

200 Views

The best practices for Selenium web test automation framework are listed below − Use of dynamic waits like implicit wait and explicit wait instead of using Thread.sleep() in the framework to handle sync issues in the application. Usage of Page Object Model framework design to segregate the test scripts from the locators. In case of changes in the web−element properties, test scripts need not be modified only the locators undergo change. Usage of Behaviour Driven Development framework. This allows the participation of all members in the agile team to participate in product development. Encourage testing to start from very ... Read More

Advertisements