Class AllureTestNgTestFilter

java.lang.Object
io.qameta.allure.testng.AllureTestNgTestFilter
All Implemented Interfaces:
org.testng.IMethodInterceptor, org.testng.ITestNGListener

public class AllureTestNgTestFilter extends Object implements org.testng.IMethodInterceptor
Filters TestNG methods using an Allure test plan.

TestNG calls this interceptor before execution. It keeps only methods selected by the configured Allure test plan so local and CI runs execute the requested subset.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an Allure test ng test filter with default configuration.
    AllureTestNgTestFilter(io.qameta.allure.testfilter.TestPlan testPlan)
    Creates an Allure test ng test filter with the supplied values.
  • Method Summary

    Modifier and Type
    Method
    Description
    List<org.testng.IMethodInstance>
    intercept(List<org.testng.IMethodInstance> methods, org.testng.ITestContext context)
    boolean
    isSelected(org.testng.IMethodInstance instance)
    Returns whether selected.
    boolean
    isSelected(org.testng.ITestNGMethod method)
    Returns whether selected.
    boolean
    isSelected(org.testng.ITestNGMethod testNGMethod, io.qameta.allure.testfilter.TestPlanV1_0 testPlan)
    Returns whether selected.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.testng.ITestNGListener

    isEnabled
  • Constructor Details

    • AllureTestNgTestFilter

      public AllureTestNgTestFilter()
      Creates an Allure test ng test filter with default configuration.
    • AllureTestNgTestFilter

      public AllureTestNgTestFilter(io.qameta.allure.testfilter.TestPlan testPlan)
      Creates an Allure test ng test filter with the supplied values.
      Parameters:
      testPlan - the Allure test plan to evaluate against
  • Method Details

    • intercept

      public List<org.testng.IMethodInstance> intercept(List<org.testng.IMethodInstance> methods, org.testng.ITestContext context)
      Specified by:
      intercept in interface org.testng.IMethodInterceptor
    • isSelected

      public boolean isSelected(org.testng.IMethodInstance instance)
      Returns whether selected.
      Parameters:
      instance - the TestNG method instance to evaluate
      Returns:
      true when selected; false otherwise
    • isSelected

      public boolean isSelected(org.testng.ITestNGMethod method)
      Returns whether selected.
      Parameters:
      method - the framework or Java method to inspect
      Returns:
      true when selected; false otherwise
    • isSelected

      public boolean isSelected(org.testng.ITestNGMethod testNGMethod, io.qameta.allure.testfilter.TestPlanV1_0 testPlan)
      Returns whether selected.
      Parameters:
      testNGMethod - the TestNG method to evaluate
      testPlan - the Allure test plan to evaluate against
      Returns:
      true when selected; false otherwise