Found 519 Articles for Selenium

How to use TestNG @After Annotation?

Ashish Anand
Updated on 21-Aug-2023 11:37:06

122 Views

A TestNG class can have various @After TestNG methods. Such as: @AfterTest @AfterSuite @AfterClass @AfterMethod etc. This article will explain the order of execution of different TestNG methods. TestNG consists of following @After methods to support main @Test method. The order of execution of @After methods should be as following: Key Points in this Order are First of all, 1st @test() method is executed in above example. The AfterSuite() method executes only once. Even the methods AfterClass(), and AfterTest() methods are executed only once. AfterMethod() method executes for each test case (every time ... Read More

How to use TestNG with Java?

Ashish Anand
Updated on 21-Aug-2023 11:12:02

64 Views

Testing is the process of checking the functionality of an application to ensure it works as per requirements. Unit testing comes into picture at the developer level where adequate measures are taken to test every single entity (class or method) to ensure the final product meets the requirements. JUnit has driven developers to understand the usefulness of tests, especially of unit tests, when compared to any other testing framework. Leveraging a rather simple, pragmatic, and strict architecture, JUnit has been able to "infect" great number of developers. Do look at our tutorial on JUnit to have a good understanding of ... Read More

How to do Cross Browsing Testing in Selenium with TestNG?

Ashish Anand
Updated on 21-Aug-2023 11:09:50

55 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 analyze how to perform cross browser testing in Selenium ... Read More

What all TestNG Annotations are Used in Selenium?

Ashish Anand
Updated on 21-Aug-2023 11:08:05

86 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

What is TestNG Annotation Syntax?

Ashish Anand
Updated on 21-Aug-2023 11:05:36

103 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. Java 1.5 or higher version allows to interact with TestNG. To run any test or code only in java we must use java main method. TestNG provides us a framework that ... Read More

TestNG – An Open-Source Testing Tool for Java

Ashish Anand
Updated on 21-Aug-2023 11:04:19

75 Views

Testing is the process of checking the functionality of an application to ensure it works as per requirements. Unit testing comes into picture at the developer level where adequate measures are taken to test every single entity (class or method) to ensure the final product meets the requirements. JUnit has driven developers to understand the usefulness of tests, especially of unit tests, when compared to any other testing framework. Leveraging a rather simple, pragmatic, and strict architecture, JUnit has been able to "infect" great number of developers. Do look at our tutorial on JUnit to have a good understanding of ... Read More

How to Execute Tests Sequentially in TestNG?

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

938 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 tutorial, let’s analyze how order of execution takes place in different ways. Scenario 1 If ... Read More

How to use TestNG annotations in Java?

Ashish Anand
Updated on 17-Aug-2023 14:24:56

77 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. Java 1.5 or higher version allows to interact with TestNG. To run any test or code only in java we must use java main method. TestNG provides us a framework that ... Read More

How to update IntelliJ Idea testng-plugin to testNG version 6.8 or latest version?

Ashish Anand
Updated on 17-Aug-2023 14:23:25

300 Views

TestNG is an open−source automation testing framework. It can be used along with build tool such as maven, Gradle, ant and even with snapshot. However, user can separately download the TestNG jar file and configure it with the project without using build tool. In this tutorial, we will see how to update IntelliJ IDEA testing−plugin to TestNG version 6.8 or latest TestNG jar. Download latest TestNG jar Following steps should be followed to download the latest/specific version of TestNG jar. Open the browser and navigate to https://testng.org. Once page opens, click on Download present at top. The ... Read More

How to test for mandatory exceptions in TestNG?

Ashish Anand
Updated on 17-Aug-2023 14:21:45

74 Views

TestNG provides an option of tracing the exception handling of code. User can test whether a code throws a desired exception or not. Here the expectedExceptions parameter is used along with the @Test annotation. This annotation is very useful in negative/exception testing. As per TestNG documentation: “The list of exceptions that a test method is expected to throw. If no exception or a different than one on this list is thrown, this test will be marked a failure.” In this article, we will see how to implement expectedExceptions in TestNG. Approach/Algorithm to solve this problem Step 1: Create MessageUtil.java ... Read More

Advertisements