本文整理汇总了Java中org.apache.tools.ant.taskdefs.optional.junit.JUnitTest类的典型用法代码示例。如果您正苦于以下问题:Java JUnitTest类的具体用法?Java JUnitTest怎么用?Java JUnitTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JUnitTest类属于org.apache.tools.ant.taskdefs.optional.junit包,在下文中一共展示了JUnitTest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: buildSummaryMsg
import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
private void buildSummaryMsg(JUnitTest suite, StringBuffer sb) {
Object [] args = {
new Long(suite.runCount()),
new Long(suite.failureCount()),
new Long(suite.errorCount()),
nf.format(suite.getRunTime() / RhnCustomFormatter.MS_PER_S)
};
MessageFormat form = new MessageFormat(
"Tests run: {0}, Failures: {1}, Errors: {2} Time elapsed: {3} sec\n");
sb.append(form.format(args));
}
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:14,代码来源:RhnCustomFormatter.java
示例17: endTestSuite
import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
/**
* called when the test suite finishes running.
* most of the interesting stuff happens here.
* prints out the overall timing, and success,
* or any failures that occur
* @param suite a <code>JUnitTest</code>
* @exception BuildException if an error occurs
*/
public void endTestSuite(JUnitTest suite) throws BuildException {
StringBuffer sb = new StringBuffer();
buildSummaryMsg(suite, sb);
buildResultsMsg(suite, sb);
if (out != null) {
try {
out.write(sb.toString().getBytes());
out.flush();
}
catch (IOException ioex) {
throw new BuildException("Unable to write output", ioex);
}
finally {
if (out != System.out && out != System.err) {
try {
out.close();
}
catch (IOException ioex2) {
System.out.println(ioex2);
}
}
}
}
}
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:37,代码来源:RhnCustomFormatter.java
示例18: actOnTestResult
import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
@Override
protected void actOnTestResult(JUnitTask.TestResultHolder result, JUnitTest test, String name) {
++total;
switch (result.exitCode) {
case JUnitTaskMirror.JUnitTestRunnerMirror.SUCCESS:
break;
case JUnitTaskMirror.JUnitTestRunnerMirror.FAILURES:
if (!failureTests.contains(test.getName())) {
failureTests.add(test.getName());
}
break;
case JUnitTaskMirror.JUnitTestRunnerMirror.ERRORS:
if (!errorTests.contains(test.getName())) {
errorTests.add(test.getName());
}
break;
}
if (result.timedOut) {
if (!timedOutTests.contains(test.getName())) {
timedOutTests.add(test.getName());
}
}
if (result.crashed) {
if (!crashedTests.contains(test.getName())) {
crashedTests.add(test.getName());
}
}
super.actOnTestResult(result, test, name);
System.out.println();
System.out.println();
System.out.println();
}
开发者ID:d3sformal,项目名称:panda,代码行数:38,代码来源:AntTestTask.java
示例19: createSuiteData
import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
/**
* Helper function to create a suite that is initialized with the
* suite name, start time, host data, and application URL.
*/
protected CMnDbTestSuite createSuiteData(JUnitTest suite) {
CMnDbTestSuite result = new CMnDbTestSuite(CMnDbTestSuite.SuiteType.JUNIT);
result.setStartTime(new Date());
result.setSuiteName(suite.getName());
result.setHostData(CMnDbHostData.getHostData());
// Load the database and host properties from the environment
String appUrl = System.getProperty(MODELN_JDBC_URL);
if ((appUrl != null) && (appUrl.length() > 0)) {
result.setJdbcUrl(appUrl);
}
return result;
}
开发者ID:ModelN,项目名称:build-management,代码行数:19,代码来源:DbJUnitFormatter.java
示例20: getSuiteName
import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入依赖的package包/类
/**
* Return the name of the test suite. If the suite object does not
* contain a value in the name field, the name will be derived from
* the class name.
*
* @param suite Test suite information
* @return Name of the test suite
*/
public String getSuiteName(JUnitTest suite) {
String suiteName = null;
String suiteClass = suite.getName();
String suitePackage = null;
// If the suite name is not specified, use the class name instead
if ((suite.getName() != null) && (suite.getName().length() > 0)) {
int delimIdx = suite.getName().lastIndexOf('.');
if ((delimIdx > 0) && (delimIdx < suite.getName().length())) {
suiteClass = suite.getName().substring(delimIdx);
suitePackage = suite.getName().substring(0, delimIdx);
} else {
suitePackage = "";
}
suiteName = suite.getName();
} else {
suiteClass = suite.getClass().getName();
suitePackage = suite.getClass().getPackage().getName();
// Trim off the fully qualified package name
if ((suitePackage != null) && suiteClass.startsWith(suitePackage) && (suiteClass.length() > suitePackage.length())) {
suiteName = suite.getName().substring(suitePackage.length() + 1);
} else {
suiteName = suite.getName();
}
}
return suiteName;
}
开发者ID:ModelN,项目名称:build-management,代码行数:40,代码来源:DbJUnitFormatter.java
注:本文中的org.apache.tools.ant.taskdefs.optional.junit.JUnitTest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论