public static TestSuite suite() throws Exception { TestInventory inventory = ServiceLocator.get().get(TestInventory.class, "auraImplExpressionTestInventory"); TestSuite suite = inventory.getTestSuite(Type.UNIT); suite.setName("aura-impl-expression unit tests"); return suite; }
private BaseSourceLoader getJavascriptSourceLoader() { if (AuraComponentsFiles.TestComponents.asFile().exists()) { return new FileSourceLoader(AuraComponentsFiles.TestComponents.asFile()); } else { String pkg = ServiceLocator.get() .get(ComponentLocationAdapter.class, "auraTestComponentLocationAdapterImpl") .getComponentSourcePackage(); return new ResourceSourceLoader(pkg); } }
ComponentTestSuite(DefDescriptor<ComponentDef> descriptor) { super(descriptor.getName()); TestInventory inventory = ServiceLocator.get().get(TestInventory.class, "auraTestInventory"); Vector<Class<? extends Test>> testClasses = inventory.getTestClasses(Type.PERFCMP); for (Class<? extends Test> testClass : testClasses) { try { Constructor<? extends Test> constructor = testClass.getConstructor(String.class, DefDescriptor.class); ComponentPerfAbstractTestCase test = (ComponentPerfAbstractTestCase) constructor.newInstance("testRun", descriptor); addTest(patchPerfComponentTestCase(test, descriptor)); } catch (Exception e) { LOG.log(Level.WARNING, "exception instantiating " + testClass.getName(), e); } } }
@Override public void run() { Collection<TestInventory> inventories = ServiceLocator.get().getAll(TestInventory.class); for (TestInventory i : inventories) { for (Type type : scope) { TestSuite suite = i.getTestSuite(type); if (suite.testCount() > 0) { addSuite(type, suite); } } } for (Test t : inventory.values()) { Map<String, Object> testWithProps = Maps.newHashMap(); testWithProps.put("name", t.toString()); testWithProps.put("selected", false); testWithProps.put("status", "Not Run Yet"); testWithProps.put("exception", ""); testWithProps.put("isHidden", ""); testWithProps.put("type", testCasesType.get(t.toString()).toString().toLowerCase()); testWithProps.put("isPerf", t instanceof PerfExecutorTest); testWithProps.put("perfInfo", ""); String url = ""; if (t instanceof ComponentTestCase) { url = ((ComponentTestCase) t).getAppUrl(); } if (t instanceof PerfExecutorTest) { // url = ((PerfExecutorTest) t).generateUrl(); List<String> urls = ((PerfExecutorTest) t).generateUrl(); if (urls.size() > 1) { for (String u : urls) { testWithProps.put("jsConsole", u); testsWithPropsMap.put(t.toString(), testWithProps); } return; } url = urls.get(0); } testWithProps.put("jsConsole", url); testsWithPropsMap.put(t.toString(), testWithProps); } }