当前位置: 首页>>代码示例>>Java>>正文


Java XmlSuite.setListeners方法代码示例

本文整理汇总了Java中org.testng.xml.XmlSuite.setListeners方法的典型用法代码示例。如果您正苦于以下问题:Java XmlSuite.setListeners方法的具体用法?Java XmlSuite.setListeners怎么用?Java XmlSuite.setListeners使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.testng.xml.XmlSuite的用法示例。


在下文中一共展示了XmlSuite.setListeners方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareMock

import org.testng.xml.XmlSuite; //导入方法依赖的package包/类
protected ITestResult prepareMock(Class<?> tClass, Method method) {
  ITestResult result = mock(ITestResult.class);
  IClass clazz = mock(IClass.class);
  ITestNGMethod testNGMethod = mock(ITestNGMethod.class);
  ConstructorOrMethod cm = mock(ConstructorOrMethod.class);
  String methodName = method.getName();
  when(result.getTestClass()).thenReturn(clazz);
  when(result.getTestClass().getRealClass()).thenReturn(tClass);
  when(clazz.getName()).thenReturn(this.getClass().getName());
  when(result.getMethod()).thenReturn(testNGMethod);
  when(cm.getMethod()).thenReturn(method);
  when(result.getMethod().getConstructorOrMethod()).thenReturn(cm);
  when(testNGMethod.getMethodName()).thenReturn(methodName);
  ITestContext context = mock(ITestContext.class);
  when(result.getTestContext()).thenReturn(context);
  XmlTest xmlTest = new XmlTest();
  XmlSuite suite = new XmlSuite();
  xmlTest.setXmlSuite(suite);
  suite.setListeners(Arrays.asList(VideoListener.class.getName()));
  when(context.getCurrentXmlTest()).thenReturn(xmlTest);
  return result;
}
 
开发者ID:SergeyPirogov,项目名称:video-recorder-java,代码行数:23,代码来源:BaseTest.java

示例2: constructXmlSuiteForParallel

import org.testng.xml.XmlSuite; //导入方法依赖的package包/类
public XmlSuite constructXmlSuiteForParallel(String pack, List<String> testcases,
                                             Map<String, List<Method>> methods,
                                             int deviceCount, ArrayList<String> deviceSerail) {
    ArrayList<String> listeners = new ArrayList<>();
    listeners.add("com.appium.manager.AppiumParallelTestListener");
    listeners.add("com.appium.utils.RetryListener");
    include(listeners, "LISTENERS");
    include(groupsInclude, "INCLUDE_GROUPS");
    include(groupsExclude, "EXCLUDE_GROUPS");
    XmlSuite suite = new XmlSuite();
    suite.setName("TestNG Forum");
    suite.setThreadCount(deviceCount);
    suite.setDataProviderThreadCount(deviceCount);
    suite.setParallel(ParallelMode.TESTS);
    suite.setVerbose(2);
    suite.setListeners(listeners);
    for (int i = 0; i < deviceCount; i++) {
        XmlTest test = new XmlTest(suite);
        test.setName("TestNG Test" + i);
        test.setPreserveOrder("false");
        test.addParameter("device", deviceSerail.get(i));
        test.setIncludedGroups(groupsInclude);
        test.setExcludedGroups(groupsExclude);
        List<XmlClass> xmlClasses = new ArrayList<>();
        writeXmlClass(testcases, methods, xmlClasses);
        test.setXmlClasses(xmlClasses);
    }
    System.out.println(suite.toXml());
    writeTestNGFile(suite);
    return suite;
}
 
开发者ID:saikrishna321,项目名称:AppiumTestDistribution,代码行数:32,代码来源:MyTestExecutor.java

示例3: constructXmlSuiteForDistribution

import org.testng.xml.XmlSuite; //导入方法依赖的package包/类
public XmlSuite constructXmlSuiteForDistribution(String pack, List<String> tests,
                                                 Map<String, List<Method>> methods,
                                                 int deviceCount) {
    include(listeners, "LISTENERS");
    include(groupsInclude, "INCLUDE_GROUPS");
    XmlSuite suite = new XmlSuite();
    suite.setName("TestNG Forum");
    suite.setThreadCount(deviceCount);
    suite.setParallel(ParallelMode.CLASSES);
    suite.setVerbose(2);
    listeners.add("com.appium.manager.AppiumParallelMethodTestListener");
    listeners.add("com.appium.utils.RetryListener");
    suite.setListeners(listeners);
    if (prop.getProperty("LISTENERS") != null) {
        suite.setListeners(listeners);
    }
    XmlTest test = new XmlTest(suite);
    test.setName("TestNG Test");
    test.addParameter("device", "");
    include(groupsExclude, "EXCLUDE_GROUPS");
    test.setIncludedGroups(groupsInclude);
    test.setExcludedGroups(groupsExclude);
    List<XmlClass> xmlClasses = new ArrayList<>();
    writeXmlClass(tests, methods, xmlClasses);
    test.setXmlClasses(xmlClasses);
    System.out.println(suite.toXml());
    writeTestNGFile(suite);
    return suite;
}
 
开发者ID:saikrishna321,项目名称:AppiumTestDistribution,代码行数:30,代码来源:MyTestExecutor.java

示例4: constructXmlSuiteForDistributionMethods

import org.testng.xml.XmlSuite; //导入方法依赖的package包/类
public XmlSuite constructXmlSuiteForDistributionMethods(String pack, List<String> tests,
                                                        Map<String, List<Method>> methods,
                                                        int deviceCount) {
    include(listeners, "LISTENERS");
    include(groupsInclude, "INCLUDE_GROUPS");
    XmlSuite suite = new XmlSuite();
    suite.setName("TestNG Forum");
    suite.setThreadCount(deviceCount);
    suite.setDataProviderThreadCount(deviceCount);
    suite.setVerbose(2);
    suite.setParallel(ParallelMode.METHODS);
    listeners.add("com.appium.manager.AppiumParallelMethodTestListener");
    listeners.add("com.appium.utils.RetryListener");
    suite.setListeners(listeners);
    if (prop.getProperty("LISTENERS") != null) {
        suite.setListeners(listeners);
    }
    List<XmlClass> xmlClasses = new ArrayList<>();
    xmlClasses = writeXmlClass(tests, methods, xmlClasses);
    XmlTest test = new XmlTest(suite);
    test.setName("TestNG Test");
    test.addParameter("device", "");
    include(groupsExclude, "EXCLUDE_GROUPS");
    test.setIncludedGroups(groupsInclude);
    test.setExcludedGroups(groupsExclude);
    List<XmlClass> writeXml = new ArrayList<>();
    for (int i = 0; i < xmlClasses.size(); i++) {
        writeXml.add(new XmlClass(xmlClasses.get(i).getName()));
        test.setClasses(writeXml);
    }
    System.out.println(suite.toXml());
    writeTestNGFile(suite);
    return suite;
}
 
开发者ID:saikrishna321,项目名称:AppiumTestDistribution,代码行数:35,代码来源:MyTestExecutor.java


注:本文中的org.testng.xml.XmlSuite.setListeners方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。