Package org.testng.internal.annotations

Examples of org.testng.internal.annotations.ITest


    }

    // If this configuration method has inherit-groups=true, add the groups
    // defined in the @Test class
    if (inheritGroupsFromTestClass()) {
      ITest classAnnotation =
        (ITest) m_annotationFinder.findAnnotation(m_methodClass, ITest.class);
      if (classAnnotation != null) {
        String[] groups = classAnnotation.getGroups();
        Map<String, String> newGroups = new HashMap<String, String>();
        for (String g : getGroups()) {
          newGroups.put(g, g);
        }
        if (groups != null) {
View Full Code Here


    return result;
  }
 
  public static Method findDataProvider(Class clazz, Method m, IAnnotationFinder finder) {
    Method result = null;
    ITest annotation = AnnotationHelper.findTest(finder, m);
    if (null != annotation) {
      String dataProviderName = annotation.getDataProvider();
      if (null != dataProviderName && ! "".equals(dataProviderName)) {
        result = findDataProvider(clazz, finder, dataProviderName, annotation.getDataProviderClass());
      }
    }

    return result;
  }
View Full Code Here

    if (expectedExceptions != null) {
      result = expectedExceptions.getValue();
    }
    else {
      // New syntax
      ITest testAnnotation =
        (ITest) finder.findAnnotation(method, ITest.class);
      if (testAnnotation != null) {
        Class[] ee = testAnnotation.getExpectedExceptions();
        if (testAnnotation != null && ee.length > 0) {
          result = ee;
        }
      }
    }
View Full Code Here

  //
  // End of public methods
  // ///

  public static boolean isEnabled(Class objectClass, IAnnotationFinder finder) {
    ITest testClassAnnotation= AnnotationHelper.findTest(finder, objectClass);

    return isEnabled(testClassAnnotation);
  }
View Full Code Here

    return isEnabled(testClassAnnotation);
  }
 
  public static boolean isEnabled(Method m, IAnnotationFinder finder) {
    ITest annotation = AnnotationHelper.findTest(finder, m);
   
    // If no method annotation, look for one on the class
    if (null == annotation) {
      annotation = AnnotationHelper.findTest(finder, m.getDeclaringClass());
    }
View Full Code Here

    System.out.println("[TestNGMethod] " + s);
  }

  private void init() {
    {
      ITest testAnnotation = AnnotationHelper.findTest(getAnnotationFinder(), m_method);
     
      if (testAnnotation == null) {
        // Try on the class
        testAnnotation = AnnotationHelper.findTest(getAnnotationFinder(), m_method.getDeclaringClass());
      }

      if (null != testAnnotation) {
        m_timeOut = testAnnotation.getTimeOut();
      }

      if (null != testAnnotation) {
        m_successPercentage = testAnnotation.getSuccessPercentage();

        setInvocationCount(testAnnotation.getInvocationCount());
        setThreadPoolSize(testAnnotation.getThreadPoolSize());
      }

      // Groups
      {
        initGroups(ITest.class);
      }

      // Other annotations
      if (null != testAnnotation) {
        setAlwaysRun(testAnnotation.getAlwaysRun());
        setDescription(testAnnotation.getDescription());
      }
    }
  }
View Full Code Here

    Map<String, XmlSuite> suites = new HashMap<String, XmlSuite>();
    IAnnotationFinder finder = getAnnotationFinder();
   
    for (int i = 0; i < classes.length; i++) {
      Class c = classes[i];
      ITest test = (ITest) finder.findAnnotation(c, ITest.class);
      String suiteName = getDefaultSuiteName();
      String testName = getDefaultTestName();
      if (test != null) {
        final String candidateSuiteName = test.getSuiteName();
        if (candidateSuiteName != null && !"".equals(candidateSuiteName)) {
          suiteName = candidateSuiteName;
        }
        final String candidateTestName = test.getTestName();
        if (candidateTestName != null && !"".equals(candidateTestName)) {
          testName = candidateTestName;  
        }
      } 
      XmlSuite xmlSuite = suites.get(suiteName);
View Full Code Here

  public static String[] dependentGroupsForThisMethodForTest(Method m, IAnnotationFinder finder) {
    List<String> vResult = new ArrayList<String>();
    Class<?> cls = m.getDeclaringClass();

    // Collect groups on the class
    ITest tc = AnnotationHelper.findTest(finder, cls);
    if (null != tc) {
      for (String group : tc.getDependsOnGroups()) {
        vResult.add(group);
      }
    }

    // Collect groups on the method
    ITest tm = AnnotationHelper.findTest(finder, m);
    if (null != tm) {
      String[] groups = tm.getDependsOnGroups();

      //       ppp("Method:" + m + " #Groups:" + groups.length);
      for (String group : groups) {
        vResult.add(group);
      }
View Full Code Here

  public static String[] groupsForThisMethodForTest(Method m, IAnnotationFinder finder) {
    List<String> vResult = new ArrayList<String>();
    Class<?> cls = m.getDeclaringClass();

    // Collect groups on the class
    ITest tc = AnnotationHelper.findTest(finder, cls);
    if (null != tc) {
      for (String group : tc.getGroups()) {
        vResult.add(group);
      }
    }

    // Collect groups on the method
    ITest tm = AnnotationHelper.findTest(finder, m);
    if (null != tm) {
      String[] groups = tm.getGroups();

      //       ppp("Method:" + m + " #Groups:" + groups.length);
      for (String group : groups) {
        vResult.add(group);
      }
View Full Code Here

   */
  public static String[] groupsForThisMethodForConfiguration(Method m, IAnnotationFinder finder) {
    String[] result = {};

    // Collect groups on the method
    ITest tm = AnnotationHelper.findTest(finder, m);
    if (null != tm) {
      result = tm.getGroups();
    }

    return result;
  }
View Full Code Here

TOP

Related Classes of org.testng.internal.annotations.ITest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.