TestNG

  • 12
    Jul

    TestNG methods parameterization with multidimension Object arrays

    Following code snippet demonstrates TestNG methods parameterization with multidimension Object arrays

    Read More
  • 08
    Apr

    Common utilites to probe current system’s capabilities

    Following code snippet can be used to capture few of capabilities of System under test: package com.allstate.utilities; import java.awt.Dimension; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Toolkit; import java.net.InetAddress; import java.net.NetworkInterface;...

    Read More
  • 08
    Apr

    Sharing data between @Test methods

    For a given class, sharing data between @Test methods can be done via means of Class level variables class MyTestNGClass { String CustName=”Jackychan”; // This can be used across...

    Read More
  • 08
    Apr

    How to enable TestNG in eclipse

    Follow the below steps to install TestNG on eclipse: 1. From Eclipse -> Click on “Help” menu -> Click on “Install New Software”. 2. Click on the “Add” button,...

    Read More
  • 06
    Apr

    class scope annotations processing with TestNG

    Step 1: your class scoped annotation: ————————————– package com.CustomTestNG.Annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.TYPE}) public @interface TesterInfo{ public enum PRIORITY {LOW, MEDIUM, HIGH}...

    Read More
  • 06
    Apr

    Method or Constructor level custom testng annotation implementation

    Step 1: Define your METHOD scope annotation: ——————————————— package com.CustomTestNG.Annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface TesterInfo{ public enum PRIORITY {LOW, MEDIUM, HIGH}...

    Read More
  • 06
    Apr

    Default execution on configuration failures in testng

    If a TestScript if configuration methods (@BeforeSuite, @AfterSuite) fails the output captures the results as follow: =============================================== Default test Tests run: 1, Failures: 0, Skips: 0 =============================================== =============================================== Default...

    Read More
  • 05
    Apr

    dynamic data provider association for your TestNG scripts

    Generally a script needs to be tested with multiple environments, where test data may differ. Following code snippet demonstrates how to associate different data providers to same testng script...

    Read More
  • 05
    Apr

    disable TestNG scripts execution at run-time

    As part of Automation, we generally write scripts with the objective to run them at any given time. Assume your framework need to detect certain failures before execution start...

    Read More
  • 02
    Apr

    Understanding difference between @Factory and @DataProvider in TestNG

    @DataProvider: for a single running instance of script, all methods (which consumes dataprovider) are executed for data provided by DataProvider @Factory: all methods are executed a TestNG class, in...

    Read More