Found 161 Articles for Rest Assured

Advantages of TestNG over JUnit

Ashish Anand
Updated on 16-Aug-2023 14:50:50

159 Views

JUnit and TestNG are the most popular testing frameworks for Java applications. Both frameworks are easy to use. So, when it comes to choose the testing framework for your application, it’s better to have a high−level idea of what features are present in one or the other and then take the informed decision based on your project requirements. In this article, we will compare and contrast the different features of TestNG and JUnit. JUnit vs TestNG The following table compares JUnit vs TestNG on different features. The table excludes very specific or common features that are present in both these ... Read More

Advantages of using TestNG with Cucumber

Ashish Anand
Updated on 16-Aug-2023 14:49:34

237 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. What is Cucumber? Cucumber is a testing tool that supports Behaviour Driven Development (BDD) framework. It defines application behaviour using simple English text, defined by a language called Gherkin. Cucumber allows automation functional validation that is easily read and understood. Cucumber was initially implemented in Ruby and then extended to Java framework. ... Read More

Automating Functional Tests with TestNG

Ashish Anand
Updated on 16-Aug-2023 14:48:20

83 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

How to Use Beanshell Script in TestNG?

Ashish Anand
Updated on 16-Aug-2023 13:15:53

178 Views

TestNG supports to group the test cases based on similar functionality or uses. Sometimes user has customized conditions to pick classes/methods/groups at run time based on conditions and use cases. TestNG supports simple frequently use scenarios but covering all expects are unnecessary. For Example, user may add multiple groups to single test. While running the group using syntax, TestNG runs all tests those are part of the group. It works as OR statement. Like if a test has 2 groups and only 1 is mentioned in tag it will run the test. But, when user wants ... Read More

How to check reports created by TestNG?

Ashish Anand
Updated on 16-Aug-2023 13:14:20

56 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. Enable the Report Generation While running the testing.xml from IDE, the user has to enable the default reports generation at Add Configuration −> Listeners tab. The following screenshot shows how to enable default report generation in IntelliJ. If the user wants to generate report at customized path ... Read More

How to create a TestNG file in IntelliJ IDE?

Ashish Anand
Updated on 16-Aug-2023 13:09:51

462 Views

TestNG file is a simple java class. IntelliJ supports TestNG class as simple java class. To create a TestNG class, user should create a java class first and then enter the desired TestNG annotations and respective code to execute. In this article, let’s follow the steps to create a TestNG file in IntelliJ. Approach/Algorithm to solve this problem Step 1: Go to the project where TestNG file needs to create. Step 2: Select a folder where to create a TestNG file either in src or test folder. We will create the file in src folder in this article. Step ... Read More

How to continue test execution after assertion failed in TestNG?

Ashish Anand
Updated on 16-Aug-2023 12:50:28

911 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, he wants to continue the execution so all failures can be found out at the time. By default, if a failure occurs in a @Test method, TestNG gets exit from the same @Test method and continue the execution from next @Test method. Here, the use case is to continue the execution of next line even if an assertion failed in same @Test ... Read More

How to continue execution when assertion is failed in TestNG?

Ashish Anand
Updated on 16-Aug-2023 12:46:14

537 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, he wants to continue the execution so all failures can be found out at the time. By default, if a failure occurs in a @Test method, TestNG gets exit from the same @Test method and continue the execution from next @Test method. Here, the use case is to continue the execution of next line even if an assertion failed in same @Test ... Read More

How do I run classes with TestNG by wildcard in testng.xml?

Ashish Anand
Updated on 16-Aug-2023 16:21:24

142 Views

testng.xml has a format as where we define what all test classes should be executed. There is no any specific way to provide regular expression in a class in . But there are work arounds those are useful to run specific @Test from a class. TestNG supports regular expression at include, exclude and package tags. Following are few ways those are handy to use regular expression in a test class run from a test suite. Mention all class names inside . And, inside the class use and . It will exclude all tests starting with name ... Read More

How does TestNG invoke a test method using multiple threads?

Ashish Anand
Updated on 09-Mar-2022 11:44:46

3K+ Views

TestNG supports multi-threading, i.e., a @Test method can be invoked multiple times in parallel. A test method should be invoked from multiple threads so that multiple invocation is also required. If we want to run a single @Test at multi-thread, it is of no use. Therefore, multi-thread is useful if a @Test method needs to be run multiple times asynchronously.Multi-threading can be achieved by using the keyword threadPoolSize = at @Test. However, to invoke a method multiple times, another keyword invocationCount =  is required. Combining these two keywords, we can achieve multi-threading. For example, @Test(threadPoolSize=5, invocationCount = 10)In this example, ... Read More

Advertisements