use of org.sakuli.datamodel.TestCase in project sakuli by ConSol.
the class NagiosOutputBuilder method getStatusSummary.
/**
* Generates the displayed overview data for the nagios server as an {@link String}.
*
* @param testSuite finshed {@link TestSuite}
* @return formatted payload string
*/
protected String getStatusSummary(TestSuite testSuite, GearmanProperties properties) {
StringBuilder sb = new StringBuilder();
sb.append(StringUtils.remove(formatTestSuiteSummaryStateMessage(testSuite, properties.getTemplateSuiteSummary()), "\n")).append(NagiosOutput.DETAILS_SEPARATOR).append(String.format(ScreenshotDiv.STYLE_TEMPLATE, getOutputScreenshotDivWidth())).append(TABLE_HEADER).append(StringUtils.remove(formatTestSuiteTableStateMessage(testSuite, properties.getTemplateSuiteTable()), "\n"));
for (TestCase tc : testSuite.getTestCasesAsSortedSet()) {
sb.append(formatTestCaseTableStateMessage(tc, properties.lookUpTemplate(tc.getState())));
}
sb.append(TABLE_FOOTER);
return sb.toString();
}
use of org.sakuli.datamodel.TestCase in project sakuli by ConSol.
the class Icinga2OutputBuilder method build.
@Override
public String build() {
StringBuilder sb = new StringBuilder();
sb.append(formatTestSuiteSummaryStateMessage(testSuite, properties.getTemplateSuiteSummary())).append(ICINGA_SEPARATOR);
for (TestCase tc : testSuite.getTestCasesAsSortedSet()) {
String template = properties.lookUpTemplate(tc.getState());
String result = replacePlaceHolder(template, getTextPlaceholder(tc));
LOGGER.debug("{{xxx}} patterns in template '{}' replaced with message '{}'", template, result);
sb.append(result);
}
return sb.toString();
}
use of org.sakuli.datamodel.TestCase in project sakuli by ConSol.
the class RegionImplTest method testResolveTakeScreenshotFolderFallback.
@Test
public void testResolveTakeScreenshotFolderFallback() throws Exception {
TestCase tc = mock(TestCase.class);
Path examplePath = Paths.get(BaseTest.TEST_FOLDER_PATH + File.separator + "NO_tc.js");
when(tc.getTcFile()).thenReturn(examplePath);
when(loader.getCurrentTestCase()).thenReturn(tc);
TestSuite ts = mock(TestSuite.class);
when(ts.getTestSuiteFolder()).thenReturn(Paths.get(BaseTest.TEST_FOLDER_PATH));
when(loader.getTestSuite()).thenReturn(ts);
Path result = RegionImpl.resolveTakeScreenshotFolder("test", loader);
assertEquals(result.toString(), Paths.get(BaseTest.TEST_FOLDER_PATH) + File.separator + "test");
verify(loader).getTestSuite();
verify(loader).getCurrentTestCase();
}
use of org.sakuli.datamodel.TestCase in project sakuli by ConSol.
the class RhinoAspectTest method testDoTestCaseActionLog.
@Test
public void testDoTestCaseActionLog() throws Exception {
initMocks();
BaseActionLoader loader = mock(BaseActionLoader.class);
TestCase sampleTc = new TestCase("test", "testID");
when(loader.getCurrentTestCase()).thenReturn(sampleTc);
TestCaseAction testAction = new TestCaseAction();
ReflectionTestUtils.setField(testAction, "loader", loader, BaseActionLoader.class);
testAction.init("testID", 3, 4, "imagefolder1", "imagefolder2");
assertLastLine(logFile, testAction.getClass().getSimpleName(), LogLevel.INFO, "\"test case [" + sampleTc.getActionValueString() + "]\" TestCaseAction.init() - init a new test case with arg(s) [testID, 3, 4, [imagefolder1, imagefolder2]]");
}
use of org.sakuli.datamodel.TestCase in project sakuli by ConSol.
the class TestSuiteExampleBuilder method buildExample.
public TestSuite buildExample() {
TestSuite testSuite = new TestSuite();
testSuite.setName("Unit Test Sample Test Suite");
testSuite.setId(id);
testSuite.setStartDate(startDate);
testSuite.setStopDate(stopDate);
testSuite.setWarningTime(warningTime);
testSuite.setCriticalTime(criticalTime);
testSuite.setState(state);
testSuite.setHost(host);
testSuite.setBrowserInfo("Firefox Test Browser");
testSuite.addException(exception);
testSuite.setTestSuiteFolder(folder);
testSuite.setBrowserInfo(browserInfo);
for (TestCase testCase : testCases) {
testSuite.addTestCase(testCase.getId(), testCase);
}
return testSuite;
}
Aggregations