Examples of ITestClass


Examples of org.testng.ITestClass

      int mq = 0;
      int cq = 0;
      for (ITestNGMethod method : getMethodSet(tests, suite)) {
        m_row += 1;
        m_methodIndex += 1;
        ITestClass testClass = method.getTestClass();
        String className = testClass.getName();
        if (mq == 0) {
          String id = (m_testIndex == null ? null : "t" + Integer.toString(m_testIndex));
          titleRow(testname + " — " + style + details, 5, id);
          m_testIndex = null;
        }
View Full Code Here

Examples of org.testng.ITestClass

      ITestNGMethod[] methods = sr.getTestContext().getAllTestMethods();
      methodCount += Utils.calculateInvokedMethodCount(methods);

      // Collect testClasses
      for (ITestNGMethod tm : methods) {
        ITestClass tc = tm.getTestClass();
        m_classes.put(tc.getRealClass().getName(), tc);
      }
    }

    String name = "Results for " + suite.getName();
    tableOfContents
        .append("<html>\n")
        .append("<head>\n")
        .append("<title>" + name + "</title>\n")
        .append(HtmlHelper.getCssString())
        .append("</head>\n")
        ;
    tableOfContents
        .append("<body>\n")
        .append("<h3><p align=\"center\">" + makeTitle(suite) + "</p></h3>\n")
        .append("<table border='1' width='100%'>\n")
        .append("<tr valign='top'>\n")
          .append("<td>")
            .append(suiteResults.size()).append(" ").append(pluralize(suiteResults.size(), "test"))
          .append("</td>\n")
          .append("<td>")
              .append("<a target='mainFrame' href='").append(CLASSES).append("'>")
              .append(m_classes.size() + " " + pluralize(m_classes.size(), "class"))
              .append("</a>")
          .append("</td>\n")
          .append("<td>" + methodCount + " " + pluralize(methodCount, "method") + ":<br/>\n")
            .append("&nbsp;&nbsp;<a target='mainFrame' href='").append(METHODS_CHRONOLOGICAL).append("'>").append("chronological</a><br/>\n")
            .append("&nbsp;&nbsp;<a target='mainFrame' href='").append(METHODS_ALPHABETICAL).append("\'>").append("alphabetical</a><br/>\n")
            .append("&nbsp;&nbsp;<a target='mainFrame' href='").append(METHODS_NOT_RUN).append("'>not run (" + suite.getExcludedMethods().size() + ")</a>")
          .append("</td>\n")
        .append("</tr>\n")

        .append("<tr>\n")
        .append("<td><a target='mainFrame' href='").append(GROUPS).append("'>").append(groupCount + pluralize(groupCount, " group") + "</a></td>\n")
        .append("<td><a target='mainFrame' href='").append(REPORTER_OUTPUT).append("'>reporter output</a></td>\n")
        .append("<td><a target='mainFrame' href='").append(TESTNG_XML).append("'>testng.xml</a></td>\n")
        .append("</tr>")
        .append("</table>");

      //
      // Generate results for individual tests
      //

      // Order the results so we can show the failures first, then the skip and
      // finally the successes
      Map<String, ISuiteResult> redResults = Maps.newHashMap();
      Map<String, ISuiteResult> yellowResults = Maps.newHashMap();
      Map<String, ISuiteResult> greenResults = Maps.newHashMap();

      for (Map.Entry<String, ISuiteResult> entry : suiteResults.entrySet()) {
        String suiteName = entry.getKey();
        ISuiteResult sr = entry.getValue();
        ITestContext tc = sr.getTestContext();
        int failed = tc.getFailedTests().size();
        int skipped = tc.getSkippedTests().size();
        int passed = tc.getPassedTests().size();

        if (failed > 0) {
          redResults.put(suiteName, sr);
        }
        else if (skipped > 0) {
View Full Code Here

Examples of org.testng.ITestClass

        nwXmlTest.getXmlClasses().add(xmlClass);
      }
      else {
        // initially duplicate the class
        XmlClass nwXmlClass= clone(xmlClass);
        ITestClass itc= testMethods.m_testClasses.get(fqn);
        List<ITestNGMethod> nonfailed= getNonFailedMethods(testMethods, fqn);
       
        for(ITestNGMethod itm: nonfailed) {
          nwXmlClass.getExcludedMethods().add(itm.getMethod().getName());
        }
View Full Code Here

Examples of org.testng.ITestClass

      }
    }
  }
 
  private List<ITestNGMethod> getNonFailedMethods(XmlTestMethods tmethods, String classFqn) {
    ITestClass itc= tmethods.m_testClasses.get(classFqn);
    List<ITestNGMethod> result= new ArrayList<ITestNGMethod>();   
    List<ITestNGMethod> failedMethods= tmethods.m_failedMethodsPClass.get(classFqn);

    if (null != failedMethods) {
      Map<Method, ITestNGMethod> failedMethodsMap= new HashMap<Method, ITestNGMethod>();
   
      for(ITestNGMethod itm: failedMethods) {
        failedMethodsMap.put(itm.getMethod(), itm);
      }
   
    
      for(ITestNGMethod itm: itc.getTestMethods()) {
        if (!failedMethodsMap.containsKey(itm.getMethod())) {
          result.add(itm);
        }
      }
    }
    else {
      for(ITestNGMethod itm: itc.getTestMethods()) {
        result.add(itm);
      }
    }
   
    return result;
View Full Code Here

Examples of org.testng.ITestClass

       * return if the method is not enabled. No need to do any more calculations
       */
      return result;
    }

    ITestClass testClass= testMethod.getTestClass();
    long start = System.currentTimeMillis();

    // For invocationCount > 1 and threadPoolSize > 1 the method will be invoked on a thread pool
    long timeOutInvocationCount = testMethod.getInvocationTimeOut();
    //FIXME: Is this correct?
    boolean onlyOne = testMethod.getThreadPoolSize() > 1 ||
      timeOutInvocationCount > 0;

    int invocationCount = onlyOne ? 1 : testMethod.getInvocationCount();
    int failureCount = 0;

    ExpectedExceptionsHolder expectedExceptionHolder =
        MethodHelper.findExpectedExceptions(m_annotationFinder, testMethod.getMethod());
    while(invocationCount-- > 0) {
      boolean okToProceed = checkDependencies(testMethod, allTestMethods);

      if (!okToProceed) {
        //
        // Not okToProceed. Test is being skipped
        //
        ITestResult testResult = new TestResult(testClass, null /* instance */,
                                               testMethod,
                                               null /* cause */,
                                               start,
                                               System.currentTimeMillis());
        String missingGroup = testMethod.getMissingGroup();
        if (missingGroup != null) {
          testResult.setThrowable(new Throwable("Method " + testMethod
              + " depends on nonexistent group \"" + missingGroup + "\""));
        }

        testResult.setStatus(ITestResult.SKIP);
        result.add(testResult);
        m_notifier.addSkippedTest(testMethod, testResult);
        runTestListeners(testResult);
        return result;
      }

      //
      // If threadPoolSize specified, run this method in its own pool thread.
      //
      if (testMethod.getThreadPoolSize() > 1 && testMethod.getInvocationCount() > 1) {
          return invokePooledTestMethods(testMethod, allTestMethods, suite,
              parameters, groupMethods, testContext);
      }
      //
      // No threads, regular invocation
      //
      else {
        ITestNGMethod[] beforeMethods = filterMethods(testClass, testClass.getBeforeTestMethods());
        ITestNGMethod[] afterMethods = filterMethods(testClass, testClass.getAfterTestMethods());

        Map<String, String> allParameterNames = Maps.newHashMap();
        ParameterBag bag = createParameters(testClass, testMethod,
            parameters, allParameterNames, null, suite, testContext, instances[0],
            null);
View Full Code Here

Examples of org.testng.ITestClass

      XmlSuite suite,
      Map<String, String> parameters)
  {
    // Invoke @BeforeGroups on the original method (reduce thread contention,
    // and also solve thread confinement)
    ITestClass testClass= testMethod.getTestClass();
    Object[] instances = testClass.getInstances(true);
    for(Object instance: instances) {
      invokeBeforeGroupsConfigurations(testClass, testMethod, groupMethods, suite, parameters, instance);
    }

View Full Code Here

Examples of org.testng.ITestClass

      ITestNGMethod[] methods = sr.getTestContext().getAllTestMethods();
      methodCount += Utils.calculateInvokedMethodCount(methods);

      // Collect testClasses
      for (ITestNGMethod tm : methods) {
        ITestClass tc = tm.getTestClass();
        m_classes.put(tc.getRealClass().getName(), tc);
      }
    }

    String name = "Results for " + suite.getName();
    tableOfContents
        .append("<html>\n")
        .append("<head>\n")
        .append("<title>" + name + "</title>\n")
        .append(HtmlHelper.getCssString())
        .append("</head>\n")
        ;
    tableOfContents
        .append("<body>\n")
        .append("<h3><p align=\"center\">" + makeTitle(suite) + "</p></h3>\n")
        .append("<table border='1' width='100%'>\n")
        .append("<tr valign='top'>\n")
          .append("<td>")
            .append(suiteResults.size()).append(" ").append(pluralize(suiteResults.size(), "test"))
          .append("</td>\n")
          .append("<td>")
              .append("<a target='mainFrame' href='").append(CLASSES).append("'>")
              .append(m_classes.size() + " " + pluralize(m_classes.size(), "class"))
              .append("</a>")
          .append("</td>\n")
          .append("<td>" + methodCount + " " + pluralize(methodCount, "method") + ":<br/>\n")
            .append("&nbsp;&nbsp;<a target='mainFrame' href='").append(METHODS_CHRONOLOGICAL).append("'>").append("chronological</a><br/>\n")
            .append("&nbsp;&nbsp;<a target='mainFrame' href='").append(METHODS_ALPHABETICAL).append("\'>").append("alphabetical</a><br/>\n")
            .append("&nbsp;&nbsp;<a target='mainFrame' href='").append(METHODS_NOT_RUN).append("'>not run (" + suite.getExcludedMethods().size() + ")</a>")
          .append("</td>\n")
        .append("</tr>\n")

        .append("<tr>\n")
        .append("<td><a target='mainFrame' href='").append(GROUPS).append("'>").append(groupCount + pluralize(groupCount, " group") + "</a></td>\n")
        .append("<td><a target='mainFrame' href='").append(REPORTER_OUTPUT).append("'>reporter output</a></td>\n")
        .append("<td><a target='mainFrame' href='").append(TESTNG_XML).append("'>testng.xml</a></td>\n")
        .append("</tr>")
        .append("</table>");

      //
      // Generate results for individual tests
      //

      // Order the results so we can show the failures first, then the skip and
      // finally the successes
      Map<String, ISuiteResult> redResults = Maps.newHashMap();
      Map<String, ISuiteResult> yellowResults = Maps.newHashMap();
      Map<String, ISuiteResult> greenResults = Maps.newHashMap();

      for (Map.Entry<String, ISuiteResult> entry : suiteResults.entrySet()) {
        String suiteName = entry.getKey();
        ISuiteResult sr = entry.getValue();
        ITestContext tc = sr.getTestContext();
        int failed = tc.getFailedTests().size();
        int skipped = tc.getSkippedTests().size();
        int passed = tc.getPassedTests().size();

        if (failed > 0) {
          redResults.put(suiteName, sr);
        }
        else if (skipped > 0) {
View Full Code Here

Examples of org.testng.ITestClass

    // 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

Examples of org.testng.ITestClass

      ITestNGMethod[] methods = sr.getTestContext().getAllTestMethods();
      methodCount += Utils.calculateInvokedMethodCount(methods);
       
      // Collect testClasses
      for (ITestNGMethod tm : methods) {
        ITestClass tc = tm.getTestClass();
        m_classes.put(tc.getRealClass().getName(), tc);
      }
    }
     
    String name = "Results for " + suite.getName();
    tableOfContents
        .append("<html>\n")
        .append("<head>\n")
        .append("<title>" + name + "</title>\n")
        .append(HtmlHelper.getCssString())
        .append("</head>\n")
        ;
    tableOfContents
        .append("<body>\n")
        .append("<h3><p align=\"center\">" + makeTitle(suite) + "</p></h3>\n")
        .append("<table border='1' width='100%'>\n")
        .append("<tr valign='top'>\n")
          .append("<td>")
            .append(suiteResults.size()).append(" ").append(pluralize(suiteResults.size(), "test"))
          .append("</td>\n")
          .append("<td>")
              .append("<a target='mainFrame' href='").append(CLASSES).append("'>")
              .append(m_classes.size() + " " + pluralize(m_classes.size(), "class"))
              .append("</a>")
          .append("</td>\n")
          .append("<td>" + methodCount + " " + pluralize(methodCount, "method") + ":<br/>\n")
            .append("&nbsp;&nbsp;<a target='mainFrame' href='").append(METHODS_CHRONOLOGICAL).append("'>").append("chronological</a><br/>\n")
            .append("&nbsp;&nbsp;<a target='mainFrame' href='").append(METHODS_ALPHABETICAL).append("\'>").append("alphabetical</a><br/>\n")
            .append("&nbsp;&nbsp;<a target='mainFrame' href='").append(METHODS_NOT_RUN).append("'>not run (" + suite.getExcludedMethods().size() + ")</a>")
          .append("</td>\n")
        .append("</tr>\n")

        .append("<tr>\n")
        .append("<td><a target='mainFrame' href='").append(GROUPS).append("'>").append(groupCount + pluralize(groupCount, " group") + "</a></td>\n")
        .append("<td><a target='mainFrame' href='").append(REPORTER_OUTPUT).append("'>reporter output</a></td>\n")
        .append("<td><a target='mainFrame' href='").append(TESTNG_XML).append("'>testng.xml</a></td>\n")
        .append("</tr>")
        .append("</table>");
     
      //
      // Generate results for individual tests
      //
     
      // Order the results so we can show the failures first, then the skip and
      // finally the successes
      Map<String, ISuiteResult> redResults = Maps.newHashMap();
      Map<String, ISuiteResult> yellowResults = Maps.newHashMap();
      Map<String, ISuiteResult> greenResults = Maps.newHashMap();
     
      for (Map.Entry<String, ISuiteResult> entry : suiteResults.entrySet()) {
        String suiteName = entry.getKey();
        ISuiteResult sr = entry.getValue();
        ITestContext tc = sr.getTestContext();
        int failed = tc.getFailedTests().size();
        int skipped = tc.getSkippedTests().size();
        int passed = tc.getPassedTests().size();
       
        if (failed > 0) {
          redResults.put(suiteName, sr);
        }
        else if (skipped > 0) {
View Full Code Here

Examples of org.testng.ITestClass

   */
  @Override
  public BaseTestMethod clone() {
    TestNGMethod clone= new TestNGMethod(getMethod(), getAnnotationFinder(), false, getXmlTest(),
        getInstance());
    ITestClass tc= getTestClass();
    NoOpTestClass testClass= new NoOpTestClass(tc);
    testClass.setBeforeTestMethods(clone(tc.getBeforeTestMethods()));
    testClass.setAfterTestMethod(clone(tc.getAfterTestMethods()));
    clone.m_testClass= testClass;
    clone.setDate(getDate());
    clone.setGroups(getGroups());
    clone.setGroupsDependedUpon(getGroupsDependedUpon(), Collections.<String>emptyList());
    clone.setMethodsDependedUpon(getMethodsDependedUpon());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.