本文整理汇总了Java中org.apache.tools.ant.taskdefs.optional.junit.JUnitTest.getName方法的典型用法代码示例。如果您正苦于以下问题:Java JUnitTest.getName方法的具体用法?Java JUnitTest.getName怎么用?Java JUnitTest.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.taskdefs.optional.junit.JUnitTest
的用法示例。
在下文中一共展示了JUnitTest.getName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: 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);
}
}
示例3: 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!!!
}
}
示例4: 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));
}
示例5: 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);
}
}
}
示例6: 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;
}
示例7: startTestSuite
import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; //导入方法依赖的package包/类
public void startTestSuite(JUnitTest suite) throws BuildException {
currentSuit = suite.getName();
failures.clear();
}