本文整理汇总了Java中junit.framework.Test类的典型用法代码示例。如果您正苦于以下问题:Java Test类的具体用法?Java Test怎么用?Java Test使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Test类属于junit.framework包,在下文中一共展示了Test类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: iterateTests
import junit.framework.Test; //导入依赖的package包/类
private void iterateTests(TestResult result, StringBuffer times, TestSuite suite, AtomicLong min, AtomicLong max) {
Enumeration en = suite.tests();
while (en.hasMoreElements()) {
Test t = (Test)en.nextElement();
if (t instanceof Callable) {
try {
Long v = (Long)((Callable) t).call();
long time = v.longValue();
if (time < min.longValue()) {
min.set(time);
}
if (time > max.longValue()) {
max.set(time);
}
// append(t.toString()).append(" value: ")
times.append("Run: ").append(v).append('\n');
} catch (Exception ex) {
result.addError(this, ex);
}
}
if (t instanceof TestSuite) {
iterateTests(result, times, (TestSuite)t, min, max);
}
}
}
示例2: suite
import junit.framework.Test; //导入依赖的package包/类
public static Test suite() {
return NbModuleSuite.create(NbModuleSuite.emptyConfiguration()
.addTest(GotoTest.class,
"testSelectTestFromMainMenu",
"testSelectTestFromExplorer",
"testSelectTestFromEditorContextMenu")
.addTest(CreateTestTest.class,
"testCreateTestByPopup",
"testCreateTestByPopup2",
"testCreateTestByPopup3",
"testCreateTestByPopup4",
"testCreateTestByWizard",
"testCreateWODefMethodBodies",
"testCreateWOHints",
"testCreateWOJavadoc",
"testCreateWOsetUp",
"testCreateWOtearDown",
"testCreateTestAndSuiteByPopup",
"testCreateTestAndSuiteByPopup2",
"testCreateIntegrationTestAndSuiteByPopup")
.enableModules(".*").clusters(".*"));
}
示例3: testsForSingletonList
import junit.framework.Test; //导入依赖的package包/类
public Test testsForSingletonList() {
return ListTestSuiteBuilder.using(
new TestStringListGenerator() {
@Override
public List<String> create(String[] elements) {
return Collections.singletonList(elements[0]);
}
})
.named("singletonList")
.withFeatures(
CollectionFeature.SERIALIZABLE,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionSize.ONE)
.suppressing(suppressForSingletonList())
.createTestSuite();
}
示例4: testTwoClassesAtOnce
import junit.framework.Test; //导入依赖的package包/类
public void testTwoClassesAtOnce() throws Exception {
System.setProperty("ins.one", "No");
System.setProperty("ins.two", "No");
System.setProperty("ins.three", "No");
System.setProperty("en.one", "No");
NbModuleSuite.Configuration config = NbModuleSuite.Configuration.create(
AskForOrgOpenideUtilEnumClass.class
).enableModules("org.openide.util.enumerations").gui(false)
.addTest(NbModuleSuiteIns.class, "testSecond");
Test instance = config.suite();
junit.textui.TestRunner.run(instance);
assertProperty("en.one", "OK");
assertProperty("ins.one", "No");
assertProperty("ins.two", "OK");
assertProperty("ins.three", "No");
}
示例5: testsForFilter
import junit.framework.Test; //导入依赖的package包/类
@GwtIncompatible // suite
private static Test testsForFilter() {
return SetTestSuiteBuilder.using(new TestStringSetGenerator() {
@Override public Set<String> create(String[] elements) {
Set<String> unfiltered = Sets.newLinkedHashSet();
unfiltered.add("yyy");
Collections.addAll(unfiltered, elements);
unfiltered.add("zzz");
return Sets.filter(unfiltered, Collections2Test.NOT_YYY_ZZZ);
}
})
.named("Sets.filter")
.withFeatures(
CollectionFeature.SUPPORTS_ADD,
CollectionFeature.SUPPORTS_REMOVE,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionFeature.KNOWN_ORDER,
CollectionSize.ANY)
.createTestSuite();
}
示例6: addError
import junit.framework.Test; //导入依赖的package包/类
@Override
public void addError(Test arg0, Throwable arg1) {
String testName = "unknown";
if (arg0 != null) {
testName = arg0.toString();
int idx = testName.indexOf('(');
if (idx > 0) {
testName = testName.substring(0, idx);
}
}
out.println(" " + testName + " had an error.");
StackTraceElement[] st = arg1.getStackTrace();
int i = 0;
for (StackTraceElement ste : st) {
if (ste.getClassName().contains("org.voltdb") == false)
continue;
out.printf(" %s(%s:%d)\n", ste.getClassName(), ste.getFileName(), ste.getLineNumber());
if (++i == 3) break;
}
m_errs++;
}
示例7: testsForArraysAsList
import junit.framework.Test; //导入依赖的package包/类
public Test testsForArraysAsList() {
return ListTestSuiteBuilder.using(
new TestStringListGenerator() {
@Override
public List<String> create(String[] elements) {
return Arrays.asList(elements.clone());
}
})
.named("Arrays.asList")
.withFeatures(
ListFeature.SUPPORTS_SET,
CollectionFeature.SERIALIZABLE,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionSize.ANY)
.suppressing(suppressForArraysAsList())
.createTestSuite();
}
示例8: suite
import junit.framework.Test; //导入依赖的package包/类
public static Test suite() {
if (hgExistsChecker.check(false)) {
return NbModuleSuite.create(NbModuleSuite.emptyConfiguration()
.addTest(InitializeTest.class, "testInitializeAndFirstCommit")
.addTest(CommitDataTest.class, "testCommitFile", "testRecognizeMimeType")
// .addTest(CommitUiTest.class, "testInvokeCloseCommit")
.addTest(IgnoreTest.class, "testIgnoreUnignoreFile")
// .addTest(DeleteUpdateTest.class, "testDeleteUpdate")
.addTest(AnnotationsTest.class, "testShowAnnotations")
.addTest(HgPropertiesTest.class, "testHgPropertiesTest")
.addTest(CloneTest.class, "testCloneProject")
.enableModules(".*")
.clusters(".*"));
} else {
return NbModuleSuite.create(NbModuleSuite.emptyConfiguration());
}
}
示例9: doRun
import junit.framework.Test; //导入依赖的package包/类
public Result doRun(Test suite, boolean wait) {
MarathonTestRunner runner = new MarathonTestRunner();
runReportDir = argProcessor.getReportDir();
String resultsDir = new File(runReportDir, "results").getAbsolutePath();
if (runReportDir != null) {
System.setProperty(Constants.PROP_REPORT_DIR, runReportDir);
System.setProperty(Constants.PROP_IMAGE_CAPTURE_DIR, runReportDir);
System.setProperty("allure.results.directory", resultsDir);
runner.addListener(new AllureMarathonRunListener());
}
runner.addListener(new TextListener(System.out));
Result result = runSuite(suite, runner);
MarathonTestCase.reset();
if (runReportDir != null && !argProcessor.isSkipreports()) {
AllureUtils.launchAllure(false, resultsDir, new File(runReportDir, "reports").getAbsolutePath());
}
return result;
}
示例10: testsForFilter
import junit.framework.Test; //导入依赖的package包/类
@GwtIncompatible // suite
private static Test testsForFilter() {
return CollectionTestSuiteBuilder.using(
new TestStringCollectionGenerator() {
@Override public Collection<String> create(String[] elements) {
List<String> unfiltered = newArrayList();
unfiltered.add("yyy");
Collections.addAll(unfiltered, elements);
unfiltered.add("zzz");
return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
}
})
.named("Collections2.filter")
.withFeatures(
CollectionFeature.SUPPORTS_ADD,
CollectionFeature.SUPPORTS_REMOVE,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionFeature.KNOWN_ORDER,
CollectionSize.ANY)
.createTestSuite();
}
示例11: testsForSingletonSet
import junit.framework.Test; //导入依赖的package包/类
public Test testsForSingletonSet() {
return SetTestSuiteBuilder.using(
new TestStringSetGenerator() {
@Override
public Set<String> create(String[] elements) {
return Collections.singleton(elements[0]);
}
})
.named("singleton")
.withFeatures(
CollectionFeature.SERIALIZABLE,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionSize.ONE)
.suppressing(suppressForSingletonSet())
.createTestSuite();
}
示例12: suite
import junit.framework.Test; //导入依赖的package包/类
public static Test suite() {
// String os = System.getProperty("os.name");
// String jdk = System.getProperty("java.version");
// if ( jdk.contains("1.5") && os.contains("Windows") && !os.contains("Vista") ) {
// return NbModuleSuite.create(NbModuleSuite.emptyConfiguration());
// } else {
return NbModuleSuite.create(NbModuleSuite.emptyConfiguration()
.addTest(WatchesTest.class,
"testWatchesPublicVariables",
"testWatchesProtectedVariables",
"testWatchesPrivateVariables",
"testWatchesPackagePrivateVariables",
"testWatchesFiltersBasic",
"testWatchesFiltersLinkedList",
"testWatchesFiltersArrayList",
"testWatchesFiltersVector",
"testWatchesFiltersHashMap",
"testWatchesFiltersHashtable",
"testWatchesFiltersTreeMap",
"testWatchesFiltersTreeSet",
"testWatchesFilters1DArray",
"testWatchesFilters2DArray",
"testWatchesValues").enableModules(".*").clusters(".*"));
// }
}
示例13: suite
import junit.framework.Test; //导入依赖的package包/类
public static Test suite() {
// String os = System.getProperty("os.name");
// String jdk = System.getProperty("java.version");
// if ( jdk.contains("1.5") && os.contains("Windows") && !os.contains("Vista") ) {
// return NbModuleSuite.create(NbModuleSuite.emptyConfiguration());
// } else {
return NbModuleSuite.create(NbModuleSuite.emptyConfiguration()
.addTest(MethodBreakpointsTest.class,
"testMethodBreakpointCreation",
"testMethodBreakpointPrefilledConstructor",
"testMethodBreakpointPrefilledMethod",
"testMethodBreakpointCreation",
"testMethodBreakpointFunctionalityInPrimaryClass",
"testMethodBreakpointFunctionalityInSecondClass",
"testMethodBreakpointFunctionalityOnAllMethods",
"testMethodBreakpointFunctionalityOnExit",
"testConditionalMethodBreakpointFunctionality",
"testMethodBreakpointsValidation"
)
.enableModules(".*").clusters(".*"));
// }
}
示例14: getGroup
import junit.framework.Test; //导入依赖的package包/类
public Test getGroup(GroupType type, String groupName) throws IOException {
File file = getGroupFile(type, groupName);
if (file == null) {
return null;
}
TestSuite testSuite = getTest(Group.findByFile(type, file.toPath()));
return testSuite;
}
示例15: testAccessToInsaneAndFSWithAllModulesEnumerated
import junit.framework.Test; //导入依赖的package包/类
public void testAccessToInsaneAndFSWithAllModulesEnumerated() {
System.setProperty("ins.one", "no");
System.setProperty("ins.fs", "no");
Test instance = NbModuleSuite.createConfiguration(NbModuleSuiteIns.class).
gui(false).clusters(".*").enableModules(".*").addTest("testFS").suite();
junit.textui.TestRunner.run(instance);
assertProperty("ins.one", "no");
assertProperty("ins.fs", "OK");
}