Running a TestNG Program using main() is very simple. We just need to use the object of TestNG class in main() and all set. Till now we have used below steps to run a TestNG program: Create class files and XML file Rightclick on XML file Select Run As Click on TestNG Suite If youRead More
@Test
TestNG -19 || Concept of Parallel Execution.
The fundamental concept of parallel execution is based on the fact that each process should have its own processor. To understand this observe the two different scenarios in the below image: Scenario – 1: We have three containers and one truck to move from Source to Destination. If it takes 1 hour to cover theRead More
TestNG – 18 || Multiple Browser and Parallel Execution in TestNG.
Parallel execution of the script on multiple browser can be handled using the TestNG very easily and in a simple way. It means same set of test cases can be run over the more than one web browser. Multiple Browser Handling First of all, we need to understand the concept of Multiple Browser Handling. ItRead More
TestNG – 13 || Use of @BeforeSuite & @AfterSuite.
Methods defined under @BeforeSuite & @AfterSuite get execute before and after all tests defined in a TestSuite.xml file. The better way to understand this by comparing the process of @BeforeTest and @BeforeSuite. Look at below images. In both programs, we have used two tests(Test-1 and Test-2) in the TestSuite.xml file. The only difference what weRead More
TestNG – 12 || Use of @BeforeGroups & @AfterGroups.
Executing specific methods before and after of a test group is possible using @BeforeGroups and @AfterGroups annotations. We have learned that using groups attribute we can create groups of test methods from multiple classes. I would recommend please go through with the previous chapter if want to learn implementation of groups attributes. Above example isRead More
TestNG – 7 || Use of @BeforeClass and @AfterClass.
BeforeClass and AfterClass annotations are like defining pre-condition and post-conditions in a Program. As in the last chapter, we have read about the BeforeMethod and AfterMethod annotations which runs before and after for each test method. But there are few scenarios where we have to execute any specific method at the starting or end ofRead More
TestNG – 6 || Use of @BeforeMethod and @AfterMethod.
As per the names, BeforeMethod and AfterMethod annotations get executed for each test method/case in a class file. Please note, that methods defined under @BeforeMethod and @AfterMethod are not considered as Test Cases. The result would be generated according to the methods defined under @Test annotations only. BeforeMethod and AfterMethod Sample program to understand theRead More
TestNG – 5 || Understand Assertion in TestNG.
The Assertion in TestNG decides the Pass/Fail status of individual Test Methods. Java Assertion is mainly used to take decisions at the code level during execution. Based on that, the flow of the program would be decided. This can be implemented using the Assert Class or assert keyword. This is not just related to TestNG.Read More
TestNG – 4 || Let’s understand @Test Annotation and attributes.
Using Annotation is the way to implement additional properties in normal methods. These annotations are pre-defined and entry-point of the programs written in TestNG framework. In the previous chapter, we have seen that keyword(annotation) @Test has been used for each method. @Test Annotation @Test Annotation is a basic and important keyword. It tells the compilerRead More