本文整理匯總了Java中junit.framework.TestCase.setName方法的典型用法代碼示例。如果您正苦於以下問題:Java TestCase.setName方法的具體用法?Java TestCase.setName怎麽用?Java TestCase.setName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類junit.framework.TestCase
的用法示例。
在下文中一共展示了TestCase.setName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: runTest
import junit.framework.TestCase; //導入方法依賴的package包/類
/**
* Run fixture setup, test from the given test case and fixture teardown.
*
* @param osgiTestExtensions
* @param testName
*/
protected TestResult runTest(final OsgiJUnitTest osgiTestExtensions, String testName) {
if (log.isDebugEnabled()) {
log.debug("Running test [" + testName + "] on testCase " + osgiTestExtensions);
}
final TestResult result = new TestResult();
TestCase rawTest = osgiTestExtensions.getTestCase();
rawTest.setName(testName);
try {
osgiTestExtensions.osgiSetUp();
try {
// use TestResult method to bypass the setUp/tearDown methods
result.runProtected(rawTest, new Protectable() {
public void protect() throws Throwable {
osgiTestExtensions.osgiRunTest();
}
});
} finally {
osgiTestExtensions.osgiTearDown();
}
}
// exceptions thrown by osgiSetUp/osgiTearDown
catch (Exception ex) {
log.error("test exception threw exception ", ex);
result.addError(rawTest, ex);
}
return result;
}