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;
}
use of org.sakuli.datamodel.TestCase in project sakuli by ConSol.
the class TestCaseAction method initWarningAndCritical.
private void initWarningAndCritical(int warningTime, int criticalTime) {
TestCase currentTestCase = loader.getCurrentTestCase();
String errormsg = TestDataEntityHelper.checkWarningAndCriticalTime(warningTime, criticalTime, currentTestCase.toStringShort());
if (errormsg != null) {
handleException(errormsg);
} else {
//if everything is ok set the times
currentTestCase.setWarningTime(warningTime);
currentTestCase.setCriticalTime(criticalTime);
}
}
use of org.sakuli.datamodel.TestCase in project sakuli by ConSol.
the class AbstractPerformanceDataBuilder method addTestCasePerformanceData.
/**
* Generates the performance data for assigned {@link TestCase}s as an {@link String}.
*
* @param data already produced performance data
* @param testCases {@link SortedSet} of {@link TestCase}s
* @return formatted payload string
*/
protected static String addTestCasePerformanceData(String data, SortedSet<TestCase> testCases) {
int i = 1;
for (TestCase tc : testCases) {
OutputState tcOutputState = OutputState.lookupSakuliState(tc.getState());
String prefix = String.format("c_%03d", i);
data = addPerformanceDataRow(data, prefix + "__state", String.valueOf(tcOutputState.getErrorCode()), null, null);
data = addPerformanceDataRow4Threshold(data, prefix, tc.getWarningTime(), tc.getCriticalTime());
final String caseName = prefix + "_" + tc.getId();
if (tc.getState() != null && tc.getState().isFinishedWithoutErrors()) {
data = addPerformanceDataRow(data, caseName, tc.getDuration(), tc.getWarningTime(), tc.getCriticalTime());
} else {
//add data performance data with unknown state
data = addUnknownPerformanceDataRow(data, caseName);
}
data = addTestCaseStepPerformanceData(data, tc.getStepsAsSortedSet(), i);
i++;
}
return data;
}
use of org.sakuli.datamodel.TestCase in project sakuli by ConSol.
the class RegionImpl method resolveTakeScreenshotFolder.
static Path resolveTakeScreenshotFolder(String filename, BaseActionLoader loader) {
Path path = Paths.get(filename);
if (path.isAbsolute()) {
return path;
}
TestCase currentTestCase = loader.getCurrentTestCase();
Path folderPath = currentTestCase != null ? currentTestCase.getTcFile() : null;
if (folderPath == null || !Files.exists(folderPath)) {
LOGGER.warn("The test case folder could be found => Fallback: Use test suite folder!");
folderPath = loader.getTestSuite().getTestSuiteFolder();
}
return folderPath.resolve(filename);
}
Aggregations