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


Java JUnitTest类代码示例

本文整理汇总了Java中org.apache.tools.ant.taskdefs.optional.junit.JUnitTest的典型用法代码示例。如果您正苦于以下问题:Java JUnitTest类的具体用法?Java JUnitTest怎么用?Java JUnitTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JUnitTest类属于org.apache.tools.ant.taskdefs.optional.junit包,在下文中一共展示了JUnitTest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startTestSuite

import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
public void startTestSuite(JUnitTest suite)
{
    failures = 0;
    errors = 0;
    tests = 0;
    suiteName = suite.getName();
    if (suiteName.lastIndexOf('.') > 0)
    {
        suiteName = suiteName.substring(suiteName.lastIndexOf('.')+1);
    }
    suiteName += "/"+System.getProperty("mithra.xml.config");
    originalOut.println("Start Suite "+ suiteName);
    lastMessageTime = System.currentTimeMillis();
    originalOut.flush();
    flush();
}
 
开发者ID:goldmansachs,项目名称:reladomo,代码行数:17,代码来源:JunitFormatter.java

示例2: testFinished

import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
@Override
public void testFinished(Description description) throws Exception {
    System.out.flush();
    System.err.flush();
    System.setOut(oldStdout);
    System.setErr(oldStderr);

    formatter.setSystemOutput(stdout.toString());
    formatter.setSystemError(stderr.toString());
    formatter.endTest(new DescriptionAsTest(description));

    JUnitTest suite = new JUnitTest(description.getDisplayName());
    suite.setCounts(1,problem,0);
    suite.setRunTime(System.currentTimeMillis()-startTime);
    formatter.endTestSuite(suite);
}
 
开发者ID:cmu-db,项目名称:peloton-test,代码行数:17,代码来源:JUnitRunner.java

示例3: endTestSuite

import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
@Override
public void endTestSuite(JUnitTest suite) throws BuildException {
    m_updateTimer.cancel();
    m_updateTimer = null;

    if ((m_failures > 0) || (m_errs > 0)) {
        out.print("(FAIL-JUNIT) ");
    }
    else {
        out.print("             ");
    }
    synchronized (out) {
        out.flush();
        out.printf("Tests run: %3d, Failures: %3d, Errors: %3d, Time elapsed: %.2f sec\n",
                m_tests, m_failures, m_errs, (System.currentTimeMillis() - m_start) / 1000.0);
        out.flush();
    }
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:19,代码来源:VoltJUnitFormatter.java

示例4: startTestSuite

import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
/**
 * The whole testsuite started.
 * @param suite the test suite
 */
public void startTestSuite(JUnitTest suite) {
    if (output == null) {
        return; // Quick return - no output do nothing.
    }
    StringBuffer sb = new StringBuffer("Testsuite: ");
    String n = suite.getName();
    if (n != null && !tag.isEmpty())
        n = n + "-" + tag;
    sb.append(n);
    sb.append(StringUtils.LINE_SEP);
    try {
        output.write(sb.toString());
        output.flush();
    } catch (IOException ex) {
        throw new BuildException(ex);
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:22,代码来源:CassandraBriefJUnitResultFormatter.java

示例5: startTestSuite

import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
/**
 * called when a test suite starts to run
 * @param suite a <code>JUnitTest</code> value
 */
public void startTestSuite(JUnitTest suite) {
    StringBuffer sb = new StringBuffer();

    Object [] args = {
        "Running ",
        suite.getName()
    };

    MessageFormat form = new MessageFormat("{0} {1}\n");

    sb.append(form.format(args));

    if (out != null) {
        try {
            out.write(sb.toString().getBytes());
            out.flush();
        }
        catch (IOException ioex) {
            throw new BuildException("Unable to write output", ioex);
        }
        // DO NOT CLOSE the out stream!!!
    }
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:28,代码来源:RhnCustomFormatter.java

示例6: buildResultsMsg

import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
private void buildResultsMsg(JUnitTest suite, StringBuffer sb) {
    Object [] args = {
        suite.getName(),
        nf.format(suite.getRunTime() / RhnCustomFormatter.MS_PER_S),
        "ok"
    };

    MessageFormat form = new MessageFormat("{0}({1}s):  {2}\n\n");

    long problemCount = suite.failureCount() + suite.errorCount();
    if (problemCount > 0) {
        args[2] = problemCount + " NOT OK";
    }

    sb.append(form.format(args));
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:17,代码来源:RhnCustomFormatter.java

示例7: startTestSuite

import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
@Override
public void startTestSuite(JUnitTest suite)
{
  if (output_ == null || suite.runCount()>0) {
    return;
  }
  if (suite.runCount()>0) {
    output_.println();
    output_.println();
  }

  output_.println("----------------------------------------------------------");
  output_.println(suite.getName());
  output_.println();
  output_.flush();

  count_total_ = 0;
  count_fail_ = 0;
  count_long_ = 0;
}
 
开发者ID:Titousensei,项目名称:sisyphus,代码行数:21,代码来源:OneLinerFormatter.java

示例8: startTestSuite

import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
@Override
public void startTestSuite(JUnitTest suite) throws BuildException {
    m_currentSuite = suite;
    m_tests = m_errs = m_failures = 0;
    m_start = System.currentTimeMillis();
    out.println("Running " + suite.getName());
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:8,代码来源:VoltJUnitFormatter.java

示例9: testStarted

import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
@Override
public void testStarted(Description description) throws Exception {
    formatter.startTestSuite(new JUnitTest(description.getDisplayName()));
    formatter.startTest(new DescriptionAsTest(description));
    problem = 0;
    startTime = System.currentTimeMillis();

    this.oldStdout = System.out;
    this.oldStderr = System.err;
    System.setOut(new PrintStream(stdout = new ByteArrayOutputStream()));
    System.setErr(new PrintStream(stderr = new ByteArrayOutputStream()));
}
 
开发者ID:cmu-db,项目名称:peloton-test,代码行数:13,代码来源:JUnitRunner.java

示例10: startTestSuite

import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
@Override
public void startTestSuite(JUnitTest suite) throws BuildException {
    m_currentSuite = suite;
    m_tests = m_errs = m_failures = 0;
    m_start = System.currentTimeMillis();
    out.println("  Running " + suite.getName());

    // print a message to the console every few minutes so you know
    // roughly how long you've been running a test
    assert(m_updateTimer == null);
    DurationUpdater updateTask = new DurationUpdater();
    m_updateTimer = new Timer("Duration Printer from JUnit Results Formatter");
    int duration = DURATION_UPDATE_PERIOD_MIN * 60 * 1000; // ms
    m_updateTimer.schedule(updateTask, duration, duration);
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:16,代码来源:VoltJUnitFormatter.java

示例11: startTestSuite

import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
@Override
public void startTestSuite(JUnitTest suite) throws BuildException {

    InitializingListener listener = new InitializingListener();
    try {
        listener.testRunStarted(null);
    } catch (Exception e) {
        throw new BuildException("Failed to run EvoSuite initializing listener: "+e.getMessage(), e);
    }

}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:12,代码来源:AntInitializingListener.java

示例12: endTestSuite

import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
public void endTestSuite(JUnitTest suite) throws BuildException {
        for (File failure : failures) {
            try {
                copyFile(failure, new File(FAILED_TEST_RECORDINGS, failure.getName()));
            } catch (IOException e) {
                throw new BuildException("Cannot copy " + failure);
            }
        }
}
 
开发者ID:google-code-export,项目名称:windowlicker,代码行数:10,代码来源:RecordingFormatter.java

示例13: startTestSuite

import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
/**
     * The whole testsuite started.
     * @param suite the testsuite.
     */
    public void startTestSuite(final JUnitTest suite) {
        doc = getDocumentBuilder().newDocument();
        rootElement = doc.createElement(TESTSUITE);
        String n = suite.getName();
//        if (n != null && !tag.isEmpty())
//            n = n + "-" + tag;
        rootElement.setAttribute(ATTR_NAME, n == null ? UNKNOWN : n);

        //add the timestamp
        final String timestamp = DateUtils.format(new Date(),
                DateUtils.ISO8601_DATETIME_PATTERN);
        rootElement.setAttribute(TIMESTAMP, timestamp);
        //and the hostname.
        rootElement.setAttribute(HOSTNAME, getHostname());

        // Output properties
        final Element propsElement = doc.createElement(PROPERTIES);
        rootElement.appendChild(propsElement);
        final Properties props = suite.getProperties();
        if (props != null) {
            final Enumeration e = props.propertyNames();
            while (e.hasMoreElements()) {
                final String name = (String) e.nextElement();
                final Element propElement = doc.createElement(PROPERTY);
                propElement.setAttribute(ATTR_NAME, name);
                propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
                propsElement.appendChild(propElement);
            }
        }
    }
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:35,代码来源:CassandraXMLJUnitResultFormatter.java

示例14: endTestSuite

import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
/**
 * The whole testsuite ended.
 * @param suite the testsuite.
 * @throws BuildException on error.
 */
public void endTestSuite(final JUnitTest suite) throws BuildException {
    rootElement.setAttribute(ATTR_TESTS, "" + suite.runCount());
    rootElement.setAttribute(ATTR_FAILURES, "" + suite.failureCount());
    rootElement.setAttribute(ATTR_ERRORS, "" + suite.errorCount());
    rootElement.setAttribute(ATTR_SKIPPED, "" + suite.skipCount());
    rootElement.setAttribute(
        ATTR_TIME, "" + (suite.getRunTime() / ONE_SECOND));
    if (out != null) {
        Writer wri = null;
        try {
            wri = new BufferedWriter(new OutputStreamWriter(out, "UTF8"));
            wri.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
            (new DOMElementWriter()).write(rootElement, wri, 0, "  ");
        } catch (final IOException exc) {
            throw new BuildException("Unable to write log file", exc);
        } finally {
            if (wri != null) {
                try {
                    wri.flush();
                } catch (final IOException ex) {
                    // ignore
                }
            }
            if (out != System.out && out != System.err) {
                FileUtils.close(wri);
            }
        }
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:35,代码来源:CassandraXMLJUnitResultFormatter.java

示例15: startTestSuite

import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
@Override
public void startTestSuite(JUnitTest suite) throws BuildException {
  if (removedHandlers.size() != 0) {
    throw new IllegalStateException("removedHandlers must be empty");
  }
  if (addedHandlers.size() != 0) {
    throw new IllegalStateException("addedHandlers must be empty");
  }

  Logger root = Logger.getLogger("");
  for (Handler handler : root.getHandlers()) {
    if (handler instanceof ConsoleHandler) {
      removedHandlers.add((ConsoleHandler) handler);
    }
  }

  for (ConsoleHandler oldHandler : removedHandlers) {
    ConsoleHandler newHandler = new ConsoleHandler();
    newHandler.setLevel(oldHandler.getLevel());
    newHandler.setFilter(oldHandler.getFilter());
    newHandler.setFormatter(oldHandler.getFormatter());
    try {
      newHandler.setEncoding(oldHandler.getEncoding());
    } catch (UnsupportedEncodingException ex) {
      throw new IllegalStateException(ex);
    }
    newHandler.setErrorManager(oldHandler.getErrorManager());
    root.addHandler(newHandler);
    addedHandlers.add(newHandler);
    root.removeHandler(oldHandler);
  }
}
 
开发者ID:googlegsa,项目名称:activedirectory,代码行数:33,代码来源:JUnitLogFixFormatter.java


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