Articles on Trending Technologies

Technical articles with clear explanations and examples

Generate all Permutations of a String that follow given Constraints

Sonal Meenu Singh
Sonal Meenu Singh
Updated on 18-Aug-2023 653 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
Sonal Meenu Singh
Updated on 18-Aug-2023 693 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

How to Write a TestNG Listener that can Fetch Name of Executing Test Method?

Ashish Anand
Ashish Anand
Updated on 18-Aug-2023 332 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
Manish Kumar Saini
Updated on 18-Aug-2023 7K+ 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

How to Stop Suite Execution after First Failure in TestNG?

Ashish Anand
Ashish Anand
Updated on 18-Aug-2023 496 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

How to Run a testng.xml File From Batch for a Maven Project?

Ashish Anand
Ashish Anand
Updated on 18-Aug-2023 2K+ Views

TestNG is a testing framework and can use Maven as build tool. It helps to maintain dependencies and their version at one place in pom.xml Maven provides flexibility to run using surefire plugin. If a user has multiple testng.xml files (please note one testng files contains only one test suite), he/she may run the specific suite based on the requirement. Maven provides the flexibility to define suiteXMLFiles as variable and pass the value of variable at run time using command line. And, at the same time user can create batch file using this command and run it as batch file. ...

Read More

How to Run Specific TestNG Test Group via Maven?

Ashish Anand
Ashish Anand
Updated on 18-Aug-2023 772 Views

Maven is a project management and comprehension tool that provides a complete build lifecycle framework. User can automate the project's build infrastructure in almost no time as Maven uses a standard directory layout and a default build lifecycle. To summarize, Maven simplifies and standardizes the project build process. It handles compilation, distribution, documentation, team collaboration and other tasks seamlessly. Maven increases reusability and takes care of most of the build related tasks. TestNG is a testing framework and can use Maven as build tool. It helps to maintain dependencies and their version at one place in pom.xml User can run ...

Read More

How to Resolve TestNG Error Cannot find Class in Classpath?

Ashish Anand
Ashish Anand
Updated on 18-Aug-2023 6K+ 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 the name attribute. User should define the class name as . format. It should not have the .java extension. In the TestNG XML, the class file is incorrect and hence unable to determine the classpath of the class. Errors within the project are present and may require a clean project. ...

Read More

How to Pass Parameter to testng.xml from Command Line with Maven?

Ashish Anand
Ashish Anand
Updated on 18-Aug-2023 3K+ Views

TestNG is a testing framework and can use Maven as build tool. It helps to maintain dependencies and their version at one place in pom.xml Maven provides flexibility to run using surefire plugin. Surefire plugin has feature to pass parameter from command line to testng.xml. To achieve this, user should have to define parameter in testng.xml with default value. At run time, the user must send to parameter value to override default value. In this way, the value passed in command line take the preference and TestNG class uses it. If the value is not passed from command line, then ...

Read More

How to Disable Default Test Report Generation in TestNG?

Ashish Anand
Ashish Anand
Updated on 18-Aug-2023 597 Views

TestNG allows to run the test suites from IntelliJ IDE as well as command line. When user run the testing.xml either from IDE or command line, TestNG generates a default report. It saves all reports and respective html files in Project −>test−output folder. If folder is not present, TestNG creates the folder. However, user can disable the default test report generation if they are using customized or external reporting mechanism. In this article we will evaluate how to disable the generation of default test reports: Disable while running through IntelliJ IDE Disable while running through command line Disable ...

Read More
Showing 34531–34540 of 61,297 articles
Advertisements