private List<String> getTestMethodNames() { List<String> methodNames = new ArrayList<String>(); for (IOpenMethod method : ProjectHelper.allTesters(getOpenClass())) { methodNames.add(method.getName()); } return methodNames; }
public String getTestName(Object testMethod){ IOpenMethod method = (IOpenMethod) testMethod; String name = TableSyntaxNodeUtils.getTestName(method); String info = ProjectHelper.getTestInfo(method); return String.format("%s (%s)", name, info); }
/** * Get tests for tested method that have filled rules rows data for testing * its functionality. Run methods and tests with empty test cases are not * being processed. If you need to get all test methods, including run * methods and empty ones, use * {@link #isTestForMethod(IOpenMethod, IOpenMethod)}. */ public static IOpenMethod[] testers(IOpenMethod tested) { List<IOpenMethod> res = new ArrayList<IOpenMethod>(); for (IOpenMethod tester : tested.getDeclaringClass().getMethods()) { if (isTester(tester) && isTestForMethod(tester, tested)) { res.add(tester); } } return res.toArray(new IOpenMethod[res.size()]); }
/** * Gets all test methods for method by uri. * * @param tableUri uri for method table * @return all test methods, including tests with test cases, runs with * filled runs, tests without cases(empty), runs without any * parameters and tests without cases and runs. */ public IOpenMethod[] getTestAndRunMethods(String tableUri) { IOpenMethod method = getMethod(tableUri); if (method != null) { List<IOpenMethod> res = new ArrayList<IOpenMethod>(); Collection<IOpenMethod> methods = compiledOpenClass.getOpenClassWithErrors().getMethods(); for (IOpenMethod tester : methods) { if (ProjectHelper.isTestForMethod(tester, method)) { res.add(tester); } } return res.toArray(new IOpenMethod[0]); } return null; }
public boolean isTestable(TableSyntaxNode tsn) { IOpenMethod m = getMethod(tsn); if (m == null) { return false; } return ProjectHelper.testers(m).length > 0; }
public static TestSuiteMethod[] allTesters(IOpenClass openClass) { List<TestSuiteMethod> res = new ArrayList<TestSuiteMethod>(); for (IOpenMethod tester : openClass.getMethods()) { if (isTester(tester)) { res.add((TestSuiteMethod) tester); } if (tester instanceof OpenMethodDispatcher && isTester(((OpenMethodDispatcher) tester).getTargetMethod())) { res.add((TestSuiteMethod) ((OpenMethodDispatcher) tester).getTargetMethod()); } } TestSuiteMethod[] testSuiteMethods = new TestSuiteMethod[res.size()]; return res.toArray(testSuiteMethods); }
/** * Gets all test methods for method by uri. * * @param tableUri uri for method table * @return all test methods, including tests with test cases, runs with * filled runs, tests without cases(empty), runs without any * parameters and tests without cases and runs. */ public IOpenMethod[] getTestAndRunMethods(String tableUri) { IOpenMethod method = getMethod(tableUri); if (method != null) { List<IOpenMethod> res = new ArrayList<IOpenMethod>(); Collection<IOpenMethod> methods = compiledOpenClass.getOpenClassWithErrors().getMethods(); for (IOpenMethod tester : methods) { if (ProjectHelper.isTestForMethod(tester, method)) { res.add(tester); } } return res.toArray(new IOpenMethod[0]); } return null; }
/** * Gets test methods for method by uri. * * @param forTable uri for method table * @return test methods */ public IOpenMethod[] getTestMethods(String forTable) { IOpenMethod method = getMethod(forTable); if (method != null) { return ProjectHelper.testers(method); } return null; }
public static String getTestInfo(IOpenMethod testMethod) { if (!(testMethod instanceof TestSuiteMethod)) { return null; } return getTestInfo(testMethod, ((TestSuiteMethod) testMethod).getNumberOfTests()); }
private List<String> getTestMethodNames() { List<String> methodNames = new ArrayList<String>(); for (IOpenMethod method : ProjectHelper.allTesters(getOpenClass())) { methodNames.add(method.getName()); } return methodNames; }
/** * If tester is an instance of {@link TestSuiteMethod} and tested method * object in tester is equal to tested we consider tester is test for tested * method. */ public static boolean isTestForMethod(IOpenMethod tester, IOpenMethod tested) { if (!(tester instanceof TestSuiteMethod)) { return false; } IOpenMethod toTest = ((TestSuiteMethod) tester).getTestedMethod(); if (toTest == tested) { return true; } if (toTest instanceof OpenMethodDispatcher) { if (((OpenMethodDispatcher) toTest).getCandidates().contains(tested)) { return true; } } if (tested instanceof MethodDelegator) { return isTestForMethod(tester, tested.getMethod()); } if (tested instanceof OpenMethodDispatcher) { return isTestForMethod(tester, ((OpenMethodDispatcher) tested).getTargetMethod()); } return false; }
public boolean isTestable(TableSyntaxNode tsn) { IOpenMethod m = getMethod(tsn); if (m == null) { return false; } return ProjectHelper.testers(m).length > 0; }
public String getTestName(Object testMethod){ IOpenMethod method = (IOpenMethod) testMethod; String name = TableSyntaxNodeUtils.getTestName(method); String info = ProjectHelper.getTestInfo(method); return String.format("%s (%s)", name, info); }
public TestSuiteMethod[] getAllTestMethods() { if (isProjectCompiledSuccessfully()) { return ProjectHelper.allTesters(compiledOpenClass.getOpenClassWithErrors()); } return null; }
/** * Gets test methods for method by uri. * * @param forTable uri for method table * @return test methods */ public IOpenMethod[] getTestMethods(String forTable) { IOpenMethod method = getMethod(forTable); if (method != null) { return ProjectHelper.testers(method); } return null; }
public String getTestTableInfo(Object testResults) { return ProjectHelper.getTestInfo(((TestUnitsResults) testResults).getTestSuite()); }
public TestSuiteMethod[] getAllTestMethods() { if (isProjectCompiledSuccessfully()) { return ProjectHelper.allTesters(compiledOpenClass.getOpenClassWithErrors()); } return null; }
public String getTestTableInfo(Object testResults) { return ProjectHelper.getTestInfo(((TestUnitsResults) testResults).getTestSuite()); }
TestSuiteMethod[] tests = ProjectHelper.allTesters(openClass); for (TestSuiteMethod test : tests) { String moduleName = test.getModuleName();
public static String getTestInfo(TestSuite testSuite) { return getTestInfo(testSuite.getTestSuiteMethod(), testSuite.getNumberOfTests()); }