Execute Failed Test Cases Using Maven TestNG

Ashish Anand
Updated on 16-Aug-2023 15:20:45

892 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. There are scenarios where testcases gets failed and user want to re−run it. In such scenarios, maven creates a testng−failed.xml in target folder. The easiest way is to re−run the xml file either from command line or mention in pom.xml after 1st run. Make sure when you are mentioning the xml file in pom.xml, the file should be present otherwise it will throw the error. In this ... Read More

Add Delay in a Loop in JavaScript

AmitDiwan
Updated on 16-Aug-2023 15:20:32

5K+ Views

Loops are used in JavaScript to repeat actions or iterate over a piece of data. With the aid of various techniques, we can add a delay between each iteration of the loop in order to regulate the speed of execution or produce particular temporal effects. This article will teach you how to include a delay in a java script loop and how to use it to delay the execution of a specific piece of code that is running inside one. Let’s look at some of the examples to understand the concept better − Example 1 - Using setTimeout() In the ... Read More

Execute All Methods Sequentially in TestNG

Ashish Anand
Updated on 16-Aug-2023 15:18:59

357 Views

A TestNG class can have different tests like test1, test2, test3 etc. Once a user runs the TestNG class consisting of various tests, it runs the test cases in alphabetically order based on the name provided. However, user can assign the priority to these tests so that these tests can run as per user’s priority. Priority starts from 0 and be in incremental order. Priority 0 takes the highest priority and decreasing the priority when priority gets increase as 1, 2, 3 etc. In this article, let’s analyse how order of execution takes place in different ways. Scenario 1 If ... Read More

Exclude Specific TestNG Test Groups via Maven

Ashish Anand
Updated on 16-Aug-2023 15:17:34

372 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 include or exclude a test group at run time. User can exclude test group or groups at run time in maven using surefire plugin. In this article we will illustrate how to exclude a test group via surefire at runtime. Approach/Algorithm to solve this problem Step 1: Create a TestNG classes − NewTestngClass Step 2: Write 2 @Test method in the class with group name. Step 3: Now create the ... Read More

Maintain Order of Execution in TestNG XML

Ashish Anand
Updated on 16-Aug-2023 15:14:54

1K+ Views

In latest version, TestNG executes the classes in order as mentioned in TestNG.xml or any executable XML file. However, sometimes orders are not intake while running the tesng.xml in older version. TestNG may run the classes in random order.In latest version, TestNG executes the classes in order as mentioned in TestNG.xml or any executable XML file. However, sometimes orders are not intake while running the tesng.xml in older version. TestNG may run the classes in random order. In this article, we will discuss how to make sure order of execution remain intake as per tesng.xml TestNG supports 2 attribute − ... Read More

Check/Uncheck Checkboxes Using JavaScript

AmitDiwan
Updated on 16-Aug-2023 15:14:47

522 Views

We will learn how to check or uncheck checkboxes in javascript in this article, and how we can use it to allow users to make multiple selections on the web page Checboxes are one of the most used HTML elements in forms and user interfaces that allow users to pick numerous options. In JavaScript, we can dynamically check or uncheck checkboxes based on certain conditions or user interactions. Let’s look at some of the examples to understand the concept better − Example 1 In this example, we will − We will create 3 different checkboxes, a checkAll() and ... Read More

Toggle a Boolean Using JavaScript

AmitDiwan
Updated on 16-Aug-2023 15:08:11

6K+ Views

In this tutorial, we will learn how to toggle a boolean value in javascript. In addition to this, we will also learn how we can use it for various web application features that require toggling a certain piece of state or value. Toggling a boolean in JavaScript entails altering its value from true to false or vice versa. Toggling booleans can be helpful in a variety of situations, such as changing a boolean value to initiate an action or to toggle between states or the visibility of an element. Toggling can be implemented using different methods like the NOT operator, ... Read More

Difference Between @BeforeTest and @BeforeMethod in TestNG

Ashish Anand
Updated on 16-Aug-2023 15:06:39

4K+ Views

A TestNG class can have various TestNG methods. Such as: @BeforeTest @AfterTest @BeforeSuite @BeforeClass @BeforeMethod @test etc. As per execution order, @BeforeTest executes first and after that @BeforeMethod does. However, if there are multiple TestNG Tests inside a class, the behaviour of these methods is noticeable as @BeforeTest runs only once before the 1st @Test method runs but @BeforeMethod runs each time prior to the run of each @Test. @BeforeTest: This method will execute only once in entire execution before calling of 1st @Test method. It doesn’t matter how many @Test tag is present or how many classes ... Read More

Create Auto-Resize Text Area Using JavaScript

AmitDiwan
Updated on 16-Aug-2023 15:05:39

949 Views

In this post, we are going to learn how to set up an auto−size text area in JavaScript. This text area will be able to change its height automatically depending on the content within it. Auto−size text in JavaScript is a helpful feature that can be used to edit multiple lines of text. The text can automatically change its height depending on the content inside it. The default behavior of textarea doesn’t allow this, but we can create it by using the input event listener over it. Let’s understand how to adjust the height of the text area element dynamically ... Read More

Exclude TestNG Groups from Maven

Ashish Anand
Updated on 16-Aug-2023 15:04:55

921 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 include or exclude a test group at run time. User can exclude test group or groups at run time in maven using surefire plugin. In this tutorial, we will illustrate how to exclude a test group via surefire at runtime. Approach/Algorithm to solve this problem Step 1: Create a TestNG classes −NewTestngClass Step 2: Write 2 @Test method in the class with group name. Step 3: Now create the ... Read More

Advertisements