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
XML Suite File
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 – 11 || Groups attribute with @Test Annotation.
Groups attribute is used to create groups using various methods from multiple Classess. Mainly this attribute is used with @Test Annotations. In the above example, we have created two groups Alpha and Regression. In the Alpha group, we have added all the methods from both the classes(myProfile.java and myOrders.java). On the other hand, we haveRead More
TestNG – 9 || Let’s move deep into the Test Suites.
Test Suites widely used to organize and execute test cases from multiple class files. It also helps to create various test sets using these classes and methods. To understand this, we need to create different class files. Let’s create below class files using specific methods. LaunchAndLogin.java launchBrowser() launchURL() login() MyOrders.java viewOrders() placeOrder() MyProfile.java editProfile() saveProfile()Read More
TestNG – 8 || Creation and execution of Test Suites.
Test Suites are a combination of one or more classes (class files) and programs. Test Suite is basically an XML file, used to group and organize the test cases from different class files. Till now we have seen that we can run Test Cases written in any class file directly using Right Click on thatRead More