Package org.testng

Examples of org.testng.ITestNGMethod


    }

    private IMethodInstance mockIMethodWithTestOrderAnnotationWithParamOne() throws Exception {

        IMethodInstance methodInstance = mock(IMethodInstance.class);
        ITestNGMethod testNgMethod = mock(ITestNGMethod.class);

        when(methodInstance.getMethod()).thenReturn(testNgMethod);
        when(testNgMethod.getRealClass()).thenReturn(ClassWithMethodsToTest.class);

        mockWithMethod(testNgMethod, ClassWithMethodsToTest.WITH_TEST_ORDER_ONE);

        when(testNgMethod.getMethodsDependedUpon()).thenReturn(new String[]{});

        return methodInstance;
    }
View Full Code Here


    }

    private IMethodInstance mockIMethodWithTestOrderAnnotationWithParamTen() throws Exception {

        IMethodInstance methodInstance = mock(IMethodInstance.class);
        ITestNGMethod testNgMethod = mock(ITestNGMethod.class);

        when(methodInstance.getMethod()).thenReturn(testNgMethod);
        when(testNgMethod.getRealClass()).thenReturn(ClassWithMethodsToTest.class);

        mockWithMethod(testNgMethod, ClassWithMethodsToTest.WITH_TEST_ORDER_TEN);

        when(testNgMethod.getMethodsDependedUpon()).thenReturn(new String[]{});

        return methodInstance;
    }
View Full Code Here

     *
     * @param method the method to test.
     * @return <code>true</code> if the given method is an {@code afterXxx()} method, <code>false</code> otherwise.
     */
    private boolean isAfterMethod(final IInvokedMethod method) {
        ITestNGMethod testMethod = method.getTestMethod();
        // CSOFF: BooleanExpressionComplexity
        return testMethod.isAfterClassConfiguration() || testMethod.isAfterGroupsConfiguration()
                || testMethod.isAfterMethodConfiguration() || testMethod.isAfterSuiteConfiguration()
                || testMethod.isAfterTestConfiguration();
    }
View Full Code Here

        // Depends on methods?
        // Adds all depended methods to runningMethods
        //
        String[] mdu = m.getMethodsDependedUpon();
        for (String tm : mdu) {
          ITestNGMethod thisMethod = findMethodNamed(tm, allMethods);
          if (thisMethod != null && ! runningMethods.containsKey(thisMethod)) {
            runningMethods.put(thisMethod, thisMethod);
            newMethods.put(thisMethod, thisMethod);
          }
        }
View Full Code Here

    // Fix the method inheritance if these are @Configuration methods to make
    // sure base classes are invoked before child classes if 'before' and the
    // other way around if they are 'after'
    if (!forTests && allMethodsArray.length > 0) {
      ITestNGMethod m = allMethodsArray[0];
      boolean before = m.isBeforeClassConfiguration()
          || m.isBeforeMethodConfiguration() || m.isBeforeSuiteConfiguration()
          || m.isBeforeTestConfiguration();
      MethodInheritance.fixMethodInheritance(allMethodsArray, before);
    }

    topologicalSort(allMethodsArray, sl, pl);
View Full Code Here

    //
    List<IMethodWorker> workers= new ArrayList<IMethodWorker>();
   
    for (int i = 0; i < testMethod.getInvocationCount(); i++) {
      // we use clones for reporting purposes
      ITestNGMethod clonedMethod= testMethod.clone();
      clonedMethod.setInvocationCount(1);
      clonedMethod.setThreadPoolSize(1);

      MethodInstance mi = new MethodInstance(clonedMethod, clonedMethod.getTestClass().getInstances(true));
      workers.add(new SingleTestMethodWorker(this,
          mi,
          suite,
          parameters,
          allTestMethods,
View Full Code Here

   * @return the max timeout or 0 if no timeout was specified
   */
  public long getMaxTimeOut() {
    long result = 0;
    for (MethodInstance mi : m_testMethods) {
      ITestNGMethod tm = mi.getMethod();
      if (tm.getTimeOut() > result) {
        result = tm.getTimeOut();
      }
    }
   
    return result;
  }
View Full Code Here

  public void run() {
    Utils.log("TestMethodWorker", 2, ThreadUtil.currentThreadInfo() + ": starting TestMethodWorker#run for @" + System.identityHashCode(this));
    // Using an index here because we need to tell the invoker
    // the index of the current method
    for (int indexMethod = 0; indexMethod < m_testMethods.length; indexMethod++) {
      ITestNGMethod tm = m_testMethods[indexMethod].getMethod();
 
      ITestClass testClass = tm.getTestClass();

      invokeBeforeClassMethods(testClass, m_testMethods[indexMethod]);
     
      //
      // Invoke test method
View Full Code Here

   
    //
    // Invoke after class methods if this test method is the last one
    //
    List<Object> invokeInstances= new ArrayList<Object>();
    ITestNGMethod tm= mi.getMethod();
    if (m_classMethodMap.removeAndCheckIfLast(tm)) {
      Map<ITestClass, Set<Object>> invokedAfterClassMethods= m_classMethodMap.getInvokedAfterClassMethods();
      synchronized(invokedAfterClassMethods) {
        Set<Object> instances = invokedAfterClassMethods.get(testClass);
        if(null == instances) {
View Full Code Here

     
      // Get the transitive closure of all the failed methods and the methods
      // they depend on
      Collection<ITestResult> tests = failedTests.isEmpty() ? skippedTests : failedTests;
      for (ITestResult failedTest : tests) {
        ITestNGMethod current = failedTest.getMethod();
        if (current.isTest()) {
          methodsToReRun.put(current, current);
          ITestNGMethod method = failedTest.getMethod();
          // Don't count configuration methods
          if (method.isTest()) {
            List<ITestNGMethod> methodsDependedUpon = MethodHelper.getMethodsDependedUpon(method, context.getAllTestMethods());
           
            for (ITestNGMethod m : methodsDependedUpon) {
              if (m.isTest()) {
                methodsToReRun.put(m, m);
View Full Code Here

TOP

Related Classes of org.testng.ITestNGMethod

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.