We can use an Excel sheet as a source of input. We can access data from excel sheet using DataProvider annotation and pass arguments through @Test methods. Mainly this approach is used in Data Driven Framework. Data Driven Framework: A data-driven framework is used to run the same script for a huge amountRead More
Framework
TestNG – 10 || Use @BeforeTest and @AfterTest Annotations.
@BeforeTest and @AfterTest annotations invoke specific methods around a Test in a TestSuite. To understand these annotations let’s revisit @BeforeClass and @AfterClass annotations. As we know that in a Class file, methods marked with these annotations would be executed before and after all the test methods get executed. The same way methods marked as @BeforeTestRead 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
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
TestNG – 3 || Create and execute multiple Test Cases.
As we know that TestNG is a framework. We can create and execute multiple cases in a single class file. In the last chapter, we have learned how to define and execute a simple program using TestNG Annotation. The same way, we can use annotation @Test to declare multiple test cases in a single program.Read More
TestNG – 2 || Installation process and a sample program of TestNG.
The installation process is very simple and it’s like installing an extension in a chrome browser. Installation Process Installation Process of TestNG software is very simple and easy. Just a few clicks and framework is ready for the use. Navigate to Help > Install new Software Click Add… Add Repository > Name : Enter “TestNG”Read More