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


Java ITestNGMethod.getConstructorOrMethod方法代码示例

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


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

示例1: processTestContext

import org.testng.ITestNGMethod; //导入方法依赖的package包/类
private Map<String, ArrayList<String>> processTestContext(
		ITestContext context) {

	Map<String, ArrayList<String>> classMap = new HashMap<String, ArrayList<String>>();
	Collection<ITestNGMethod> testMethods = Arrays.asList(context.getAllTestMethods());

	for (ITestNGMethod testMethod : testMethods) {
		ConstructorOrMethod consMethod = testMethod.getConstructorOrMethod();
		String methodName = consMethod.getName();
		String className = consMethod.getDeclaringClass().getName();
		ArrayList<String> methodList;
		if (!classMap.containsKey(className)) {
			methodList = new ArrayList<String>();
		} else {
			methodList = classMap.get(className);
		}
		methodList.add(methodName);
		classMap.put(className, methodList);
	}
	return classMap;
}
 
开发者ID:menonvarun,项目名称:testInProgress-testng-client,代码行数:22,代码来源:TestNGProgressRunListener.java

示例2: intercept

import org.testng.ITestNGMethod; //导入方法依赖的package包/类
@Override
public List<IMethodInstance> intercept(List<IMethodInstance> methods, ITestContext context) {
    for (IMethodInstance methodIns : methods) {
        ITestNGMethod method = methodIns.getMethod();
        ConstructorOrMethod meth = method.getConstructorOrMethod();
        Method m = meth.getMethod();
        if (m != null) {
            DB db = m.getAnnotation(DB.class);
            if (db != null) {
                TransactionLegacy txn = TransactionLegacy.open(m.getName());
            }
        }
    }

    // TODO Auto-generated method stub
    return methods;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:18,代码来源:TestNGAop.java

示例3: getMessageSenderNameForMethod

import org.testng.ITestNGMethod; //导入方法依赖的package包/类
private String getMessageSenderNameForMethod(ITestNGMethod testMethod) {
	ConstructorOrMethod consMethod = testMethod.getConstructorOrMethod();
	String methodName = consMethod.getName();
	String className = consMethod.getDeclaringClass().getName();
	
	String methodKey = methodName + "(" + className + ")";
	return methodKey;
}
 
开发者ID:menonvarun,项目名称:testInProgress-testng-client,代码行数:9,代码来源:TestNGProgressRunListener.java

示例4: findDependedUponMethods

import org.testng.ITestNGMethod; //导入方法依赖的package包/类
/**
 * Finds TestNG methods that the specified TestNG method depends upon
 * @param m TestNG method
 * @param methods list of methods to search for depended upon methods
 * @return list of methods that match the criteria
 */
protected static ITestNGMethod[] findDependedUponMethods(ITestNGMethod m,
    ITestNGMethod[] methods)
{
  String canonicalMethodName = calculateMethodCanonicalName(m);
  List<ITestNGMethod> vResult = Lists.newArrayList();
  String regexp = null;
  for (String fullyQualifiedRegexp : m.getMethodsDependedUpon()) {
    boolean foundAtLeastAMethod = false;

    if (null != fullyQualifiedRegexp) {
      // Escapes $ in regexps as it is not meant for end - line matching, but inner class matches.
      regexp = fullyQualifiedRegexp.replace("$", "\\$");
      boolean usePackage = regexp.indexOf('.') != -1;
      Pattern pattern = Pattern.compile(regexp);

      for (ITestNGMethod method : methods) {
        ConstructorOrMethod thisMethod = method.getConstructorOrMethod();
        String thisMethodName = thisMethod.getName();
        String methodName = usePackage ?
            calculateMethodCanonicalName(method)
            : thisMethodName;
        Pair<String, String> cacheKey = Pair.create(regexp, methodName);
        Boolean match = MATCH_CACHE.get(cacheKey);
        if (match == null) {
            match = pattern.matcher(methodName).matches();
            MATCH_CACHE.put(cacheKey, match);
        }
        if (match) {
          vResult.add(method);
          foundAtLeastAMethod = true;
        }
      }
    }

    if (!foundAtLeastAMethod) {
      if (m.ignoreMissingDependencies()) {
        continue;
      }
      if (m.isAlwaysRun()) {
        continue;
      }
      Method maybeReferringTo = findMethodByName(m, regexp);
      if (maybeReferringTo != null) {
        throw new TestNGException(canonicalMethodName + "() is depending on method "
            + maybeReferringTo + ", which is not annotated with @Test or not included.");
      }
      throw new TestNGException(canonicalMethodName
          + "() depends on nonexistent method " + regexp);
    }
  }//end for

  return vResult.toArray(new ITestNGMethod[vResult.size()]);
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:60,代码来源:MethodHelper.java

示例5: onFinish

import org.testng.ITestNGMethod; //导入方法依赖的package包/类
@SuppressWarnings(
    { "rawtypes", "unchecked" } )
public void onFinish( ITestContext context )
{
    LOGGER.info( context.getCurrentXmlTest().toXml( "  " ) );
    /**
     * IResultMap results = context.getPassedTests(); Set<ITestResult>
     * testResults = results.getAllResults(); for(ITestResult tResult :
     * testResults) { //tResult. }
     */

    for ( ITestNGMethod method : context.getAllTestMethods() )
    {
        ConstructorOrMethod mOrC = method.getConstructorOrMethod();
        if ( mOrC == null )
        {
            LOGGER.info( "ConstructorOrMethod null" );
            continue;
        }
        Method m = mOrC.getMethod();
        if ( m == null )
        {
            LOGGER.info( "Method null" );
            continue;
        }
        Class c = m.getDeclaringClass();
        if ( c == null )
        {
            LOGGER.info( "Class null" );
            continue;
        }
        LOGGER.info( c.getCanonicalName() + ":" + m.getName() );
        CatsTestStep catsTestStepAnnotation = m.getAnnotation( CatsTestStep.class );
        CatsTestCase catsTestCaseAnnotation = ( CatsTestCase ) c.getAnnotation( CatsTestCase.class );
        if ( catsTestStepAnnotation == null || catsTestCaseAnnotation == null )
        {
            LOGGER.info( "Annotations not found" );
            continue;
        }
        LOGGER.info( catsTestCaseAnnotation.name() + ":" + catsTestStepAnnotation.name() );

    }
    LOGGER.info( "On Finish Found" );
}
 
开发者ID:Comcast,项目名称:cats,代码行数:45,代码来源:CatsTestListener.java


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