TestNG Tutorials 47: Marking a Parameter as Optional in TestNG

Hello folks, When we parametrize methods in a TestNG class, we must need to pass parameter values from testng xml. If we do not pass we get an exception. We will see an example below: TestNG class: Testng xml without parameters: Output: When we define a parameter in a method of a testng class, TestNG … Continue reading TestNG Tutorials 47: Marking a Parameter as Optional in TestNG

TestNG Tutorials 45: Passing Parameters at Test Method Level in TestNG

Hello folks, TestNG allows us to create parameterized methods in a TestNG class. A TestNG class may contain more than one @Test annotated methods and every test method may accept zero or more parameters. We can pass those parameters as a whole at "suite" level or "test" level. Sometimes, it becomes confusing when there are … Continue reading TestNG Tutorials 45: Passing Parameters at Test Method Level in TestNG

TestNG Tutorials 44: Constructor with @Parameter Annotation

Hello Folks, We have seen previously that how can we parameterize methods in a TestNG class. The approach of using @Parameters annotations with each methods is not so good. Some demerits of this approach are as below: You need to include @Parameters annotation with each parameterized method. You need to accept as many as attributes … Continue reading TestNG Tutorials 44: Constructor with @Parameter Annotation

TestNG Tutorials 43: Difference Between “Parameters” and “parameter” in TestNG

Hello Folks, I was asked this question in an interview and I was like "Are there two terms "Parameters" and "parameter" in TestNG?". Yes, There are two different terms, "Parameters" and "parameter". We have used both termas many times but didn't notice minor thing. "Parameters" is an annotation which allows us to create parameterized methods … Continue reading TestNG Tutorials 43: Difference Between “Parameters” and “parameter” in TestNG

TestNG Tutorials 42: Parameters In TestNG or Parameterization of Methods in a TestNG Class

Hello Folks, Arguments or Parameters help us to achieve reusability of codes and cleanliness of codes. We can do overloading of methods using different number, types and order of parameters to serve differently for different set of values. TestNG also allows you to parameterized your tests. We will see how can we achieve parameterisation of methods … Continue reading TestNG Tutorials 42: Parameters In TestNG or Parameterization of Methods in a TestNG Class

Best Practises in Page Object Model : Naming Conventions of Web Elements & Actions on it

Hello Folks, Recently I have started learning or exploring more on best practises in Selenium Framework and same I want to share through my blogs for yours learning as well as to know your views. In this post, we will learn Naming Convention for Web Element and actions on it. Let's consider a scenario: You … Continue reading Best Practises in Page Object Model : Naming Conventions of Web Elements & Actions on it

TestNG Tutorials 41: Skipping a Test Conditionally in TestNG

Hello Folks, In this post we will learn below topics: 1. How to skip a test conditionally? 2. How conditionally skipped test is reported in TestNG report? 3. How to report conditionally skipped test case as failed in TestNG report instead of skipped? 4. What is SkipException class? 5. What is use of isSkip() method? … Continue reading TestNG Tutorials 41: Skipping a Test Conditionally in TestNG

TestNG Tutorials 40: Groups of Groups or MetaGroups in TestNG

Hello Folks, Grouping is a best feature provided by TestNG. We group test scripts based on suite name or functionality based on our requirements. We have seen grouping concepts in previous posts. In this post we will another feature of grouping in TestNG. TestNG also allows you to create group of groups i.e. meta data. … Continue reading TestNG Tutorials 40: Groups of Groups or MetaGroups in TestNG

TestNG Tutorials 39: Run Only Test From a TestNG Class Without Using TestNG XML?

Hello Folks, Suppose you have created a testng class which has many @Test annotated methods say 10 test methods. You may need to run only one test out of 10 for debug/verify etc. Generally I see people will comment "@Test" annotations or use testng.xml to include required test method using include or exclude tags. There … Continue reading TestNG Tutorials 39: Run Only Test From a TestNG Class Without Using TestNG XML?