public static String getTestInfo(IOpenMethod testMethod) { if (!(testMethod instanceof TestSuiteMethod)) { return null; } return getTestInfo(testMethod, ((TestSuiteMethod) testMethod).getNumberOfTests()); }
private boolean isEqual(Object expectedResult, Object actualResult) { boolean success = true; for (IOpenField field : test.getFields()) { Object actualFieldValue = getFieldValueOrNull(actualResult, field); Object expectedFieldValue = getFieldValueOrNull(expectedResult, field); success &= isFieldEqual(field, expectedFieldValue, actualFieldValue); } return success; }
public TestUnitsResults invokeSequentially(final IOpenClass openClass, long ntimes) { TestUnitsResults testUnitResults = new TestUnitsResults(this); for (int i = 0; i < getNumberOfTests(); i++) { final ITestUnit testUnit = executeTest(openClass, i, ntimes); testUnitResults.addTestUnit(testUnit); } return testUnitResults; }
private boolean isTestForOverallTestSuiteMethod(TestSuite testSuite) { return testSuite.getTestSuiteMethod() != null && testSuite.getNumberOfTests() == testSuite.getTestSuiteMethod() .getNumberOfTests(); }
public TestUnitsResults invoke(Object target, IRuntimeEnv env) { TestUnitsResults testUnitResults = new TestUnitsResults(this); for (int i = 0; i < getNumberOfTests(); i++) { TestDescription currentTest = getTest(i); ITestUnit testUnit = testRunner.runTest(currentTest, target, env, cloner, 1L); testUnitResults.addTestUnit(testUnit); } return testUnitResults; }
public static String getTestInfo(TestSuite testSuite) { return getTestInfo(testSuite.getTestSuiteMethod(), testSuite.getNumberOfTests()); }
@Override public ParameterWithValueDeclaration[] getContextParams(TestUnitsResults objTestResult) { return TestUtils.getContextParams(objTestResult.getTestSuite(), getTest()); }
public String[] getTestDataColumnDisplayNames() { String[] columnTechnicalNames = getTestDataColumnHeaders(); String[] columnDisplayNames = new String[columnTechnicalNames.length]; for (int i = 0; i < columnDisplayNames.length; i++) { TestSuiteMethod testSuiteMethod = testSuite.getTestSuiteMethod(); String displayName = testSuiteMethod == null ? null : testSuiteMethod.getColumnDisplayName(columnTechnicalNames[i]); if (displayName != null){ columnDisplayNames[i] = displayName; }else{ columnDisplayNames[i] = columnTechnicalNames[i]; } } return columnDisplayNames; }
public static boolean isMethodRunnedBy(IOpenMethod tested, IOpenMethod runner) { if (!(runner instanceof TestSuiteMethod)) { return false; } if (runner == tested) { return true; } IOpenMethod toTest = ((TestSuiteMethod) runner).getTestedMethod(); return toTest == tested && ((TestSuiteMethod) runner).isRunmethod(); }
public boolean isRunmethod() { return testSuite.getTestSuiteMethod().isRunmethod(); }
public String getTestTableInfo(Object testResults) { return ProjectHelper.getTestInfo(((TestUnitsResults) testResults).getTestSuite()); }
public boolean hasExpected() { for (ITestUnit testUnit : testUnits) { TestDescription test = testUnit.getTest(); if (test.isExpectedResultDefined() || test.isExpectedErrorDefined()) { return true; } } return false; }
public IOpenMethod getTestedMethod() { if (testSuiteMethod != null) { return testSuiteMethod.getTestedMethod(); } else { return tests[0].getTestedMethod(); } }
@Override public ParameterWithValueDeclaration getActualParam() { return new ParameterWithValueDeclaration("actual", getActualResult()); }
private TestRunner getTestRunner() { if (testRunner == null) { TestRunner runner = new TestRunner(BaseTestUnit.Builder.getInstance()); for (ReportFormat reportFormat : reportsFormat) { // For now xlsx exporter needs all info. if (reportFormat == ReportFormat.xlsx) { runner = new TestRunner(TestUnit.Builder.getInstance()); break; } } testRunner = runner; } return testRunner; }
public boolean hasContext() { for (ITestUnit testUnit : testUnits) { if (testUnit.getTest().isRuntimeContextDefined()) { return true; } } return false; }
public boolean hasDescription() { for (ITestUnit testUnit : testUnits) { if (testUnit.getTest().getDescription() != null) { return true; } } return false; }
public String getDisplayName(int mode) { if (testSuiteMethod != null) { return testSuiteMethod.getDisplayName(mode); } else { return getName(); } }
private boolean isTestForOverallTestSuiteMethod(TestSuite testSuite) { return testSuite.getTestSuiteMethod() != null && testSuite.getNumberOfTests() == testSuite.getTestSuiteMethod() .getNumberOfTests(); }
private TestRunner getTestRunner() { if (testRunner == null) { TestRunner runner = new TestRunner(BaseTestUnit.Builder.getInstance()); for (ReportFormat reportFormat : reportsFormat) { // For now xlsx exporter needs all info. if (reportFormat == ReportFormat.xlsx) { runner = new TestRunner(TestUnit.Builder.getInstance()); break; } } testRunner = runner; } return testRunner; }