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); } } }
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(".*")); }
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(); }
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"); }
@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(); }
@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++; }
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(); }
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()); } }
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; }
@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(); }
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(); }
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(".*")); // } }
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(".*")); // } }
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; }
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"); }
/** * Simple method uniting together all the different tests under subversion * tests-qa-functional */ public static Test suite() { if (svnExistsChecker.check(false)) { return NbModuleSuite.create(NbModuleSuite.emptyConfiguration() .addTest(SvnPropertiesTest.class, "propTest") .enableModules(".*").clusters(".*")); } else { return NbModuleSuite.create(NbModuleSuite.emptyConfiguration()); } }
public void testStaticOrder(){ System.setProperty("order", "1"); String[] methods = new String[]{"testTwo", "testOne"}; Test instance = NbModuleSuite.createConfiguration(TT2.class).clusters(".*").enableModules(".*").gui(false).addTest(methods).suite(); junit.textui.TestRunner.run(instance); NbModuleSuiteTest.assertProperty("t.two", "2"); NbModuleSuiteTest.assertProperty("t.one", "3"); NbModuleSuiteTest.assertProperty(TEST_ORDER_COUNTER, "3"); }
private static IssuetableTestFactory getFromMap (Test test) { LinkedList s = (LinkedList) map.get (test); IssuetableTestFactory retVal; try { retVal = (IssuetableTestFactory) s.getLast(); } catch (NoSuchElementException x ) { System.out.println("exc: "+ test + " : " ); throw x; } return retVal; }
public void testAccessExtraDefinedAutoload() { System.setProperty("en.one", "No"); NbModuleSuite.Configuration config = NbModuleSuite.Configuration.create(AskForOrgOpenideUtilEnumClass.class); NbModuleSuite.Configuration addEnum = config.enableModules("org.openide.util.enumerations"); Test instance = addEnum.gui(false).suite(); junit.textui.TestRunner.run(instance); assertEquals("OK", System.getProperty("en.one")); }
public static Test suite() throws IOException { return CachingAndExternalPathsTest.create(new CachingAndExternalPathsTest.SetExtDirProperty() { public void setExtDirProperty(File value) { System.setProperty("ext.dir", Utilities.toURI(value).toString()); } }); }
public static Test suite() { return NbModuleSuite.create(NbModuleSuite.createConfiguration(DiffTest.class) .addTest("testDiffFile") .enableModules(".*") .clusters(".*") ); }
public static Test suite() { Test t = null; // t = new NetigsoTest("testOSGiCanRequireBundleOnNetBeans"); if (t == null) { t = new NbTestSuite(NetigsoLayerTest.class); } return t; }
public static boolean isJunit3Test(Class<?> klass) { // public class FooTest extends TestCase {...} // or // public class FooSuite { // public static Test suite() {...} // } return (TestCase.class.isAssignableFrom(klass) && !Modifier.isAbstract(klass.getModifiers())) || new ClassAnalyzer(klass).hasMethod(true, Test.class, "suite"); }
public static Test suite() { return NbModuleSuite.create( NbModuleSuite.createConfiguration(BasicTest.class).addTest( "testBasic", "testBasicCPU", "testBasicMemory", "testCascadeThreads", "testCascadeThreadsCPU", "testCascadeThreadsMemory").enableModules(".*").clusters(".*").gui(false)); }
public Test testsForAbstractSet() { return SetTestSuiteBuilder.using( new TestStringSetGenerator() { @Override protected Set<String> create(String[] elements) { final String[] deduped = dedupe(elements); return new AbstractSet<String>() { @Override public int size() { return deduped.length; } @Override public Iterator<String> iterator() { return MinimalCollection.of(deduped).iterator(); } }; } }) .named("AbstractSet") .withFeatures( CollectionFeature.NONE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionFeature.KNOWN_ORDER, // in this case, anyway CollectionSize.ANY) .suppressing(suppressForAbstractSet()) .createTestSuite(); }
public static Test suite() { return NbModuleSuite.create(NbModuleSuite.createConfiguration(BasicTest.class).addTest( "testBasicIndentation", "testAdvancedIndentation", "testReformat", "testReformat2" ).clusters(".*").enableModules(".*").gui(true)); }
/** method used for explicit testsuite definition */ public static Test suite() { return createModuleTest(HTMLNodeTest.class, tests); }
/** Assembles and returns a test suite containing all known tests. * @return A test suite. */ public static Test suite() { return new Wrapper(new TestSuite(RawTest.class)); }
public static Test suite() { return NbModuleSuite.create( NbModuleSuite.createConfiguration(PatternsTest.class) .enableModules(".*") .clusters(".*")); }
/** Method used for explicit testsuite definition * @return created suite */ public static Test suite() { return createModuleTest(NewFileWizardOperatorTest.class, tests); }
/** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); }
/** Assembles and returns a test suite containing all known tests. * @return A test suite. */ public static Test suite() { return new Wrapper(new TestSuite(StoredProcedureTest.class)); }
public static Test suite() { return GraphicsEnvironment.isHeadless() ? new TestSuite() : new TestSuite(QuickSearchTest.class); }
public static Test suite() { return NbModuleSuite.create( NbModuleSuite.createConfiguration(DiffTest.class).addTest( "testDiffFile" ).enableModules(".*").clusters(".*")); }
public static Test suite() { return JPDASupport.createTestSuite(ThreadBreakpointTest.class); }
public static Test suite() { return new TestSuite(HtmlFrameBorderLayoutTest.class); }
public static Test suite() { return new TestSuite(TestCookieVersionSupport.class); }
public static Test suite() { return new TestSuite(EntryTest.class); }
public static Test suite() { return NbModuleSuite.create( NbModuleSuite.createConfiguration(SmartCCTests.class).enableModules(".*").clusters(".*")); }