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

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

560 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

253 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

394 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

578 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

191 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

Selenium Testing on Different Browsers Using TestNG

Ashish Anand
Updated on 18-Aug-2023 11:04:57

1K+ 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'. A website should be tested across multiple browsers like IE, Chrome, Firefox, Safari to validate the compatibility of website and functionality. Since the HTML, CSS and java scripts are unique across all browsers, it is always recommended to do cross browser testing to ensure the compatibility of website. Selenium supports cross browser testing so does the TestNG. In this article, we will analyse how to perform cross browser testing in Selenium ... Read More

Run TestNG XML File from Batch for Maven Project

Ashish Anand
Updated on 18-Aug-2023 10:58:43

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

Run Specific TestNG Test Group via Maven

Ashish Anand
Updated on 18-Aug-2023 10:56:37

620 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

Run TestNG Suite from Multiple Suites Using Maven in Jenkins

Ashish Anand
Updated on 18-Aug-2023 10:52:35

924 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. Jenkins is a CI/CD tool and same flexibility it provides us to run specific testng.xml from multiple suites. In ... Read More

Advertisements