Class ISuiteYamlFactoryListener

  • All Implemented Interfaces:
    ISuiteListener, ITestNGListener

    public class ISuiteYamlFactoryListener
    extends YamlFactoryListenerBase
    implements ISuiteListener
    This listener uses file name(classpath:<suite_name>.yaml for resource(ClassLoader of current thread) of conducting data.

    By default, the DataSource would be retrieved from ISuite object(which type of IAttributes).

    Example by defulat conventions:

    
     package guru.mikelue.jdut.testng.example;
    
     // File: classpath:BullSharkSuite.yaml
     @Test(suiteName="BullSharkSuite")
     @Listeners(BullSharkTest.BullSharkSuiteListener.class)
     public class BullSharkTest {
         public static BullSharkSuiteListener extends ISuiteYamlFactoryListener {
             @Override
             public void onStart(ISuite suite)
             {
                 YamlFactoryListenerBase.setDataSource(suite, SuiteListenerForAppContext.getDataSource(suite));
                 super.onStart(suite);
             }
             @Override
             public void onFinish(ISuite suite)
             {
                 super.onFinish(suite);
                 YamlFactoryListenerBase.removeDataSource(suite);
             }
         }
    
         @Test
         public void bite()
         {
         }
     }