use of org.cerberus.crud.entity.TestCaseStepExecution in project cerberus-source by cerberustesting.
the class ControlServiceTest method testDoControlIntegerDifferentWhenValueNotNumeric.
@Test
public void testDoControlIntegerDifferentWhenValueNotNumeric() {
String property = "10";
String value = "five";
String msg = "At least one of the Properties is not numeric, can not compare properties!";
TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
tcsace.setControl("verifyNumericDifferent");
tcsace.setValue1(property);
tcsace.setValue2(value);
tcsace.setFatal("Y");
TestCaseStepExecution tcse = new TestCaseStepExecution();
tcse.settCExecution(tCExecution);
TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();
tcsae.setTestCaseStepExecution(tcse);
tcsace.setTestCaseStepActionExecution(tcsae);
this.controlService.doControl(tcsace);
Assert.assertEquals("KO", tcsace.getReturnCode());
Assert.assertEquals("Y", tcsace.getFatal());
}
use of org.cerberus.crud.entity.TestCaseStepExecution in project cerberus-source by cerberustesting.
the class ControlServiceTest method testDoControlIntegerEqualsWhenValueNotNumeric.
@Test
public void testDoControlIntegerEqualsWhenValueNotNumeric() {
String property = "10";
String value = "five";
String msg = "At least one of the Properties is not numeric, can not compare properties!";
TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
tcsace.setControl("verifyNumericEquals");
tcsace.setValue1(property);
tcsace.setValue2(value);
tcsace.setFatal("Y");
TestCaseStepExecution tcse = new TestCaseStepExecution();
tcse.settCExecution(tCExecution);
TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();
tcsae.setTestCaseStepExecution(tcse);
tcsace.setTestCaseStepActionExecution(tcsae);
this.controlService.doControl(tcsace);
Assert.assertEquals("KO", tcsace.getReturnCode());
Assert.assertEquals("Y", tcsace.getFatal());
}
use of org.cerberus.crud.entity.TestCaseStepExecution in project cerberus-source by cerberustesting.
the class ControlServiceTest method testDoControlIntegerDifferentWhenPropertyNotNumeric.
@Test
public void testDoControlIntegerDifferentWhenPropertyNotNumeric() {
String property = "five";
String value = "5";
String msg = "At least one of the Properties is not numeric, can not compare properties!";
TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
tcsace.setControl("verifyNumericDifferent");
tcsace.setValue1(property);
tcsace.setValue2(value);
tcsace.setFatal("Y");
TestCaseStepExecution tcse = new TestCaseStepExecution();
tcse.settCExecution(tCExecution);
TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();
tcsae.setTestCaseStepExecution(tcse);
tcsace.setTestCaseStepActionExecution(tcsae);
this.controlService.doControl(tcsace);
Assert.assertEquals("KO", tcsace.getReturnCode());
Assert.assertEquals("Y", tcsace.getFatal());
}
use of org.cerberus.crud.entity.TestCaseStepExecution in project cerberus-source by cerberustesting.
the class ControlServiceTest method testDoControlIntegerMinorWhenValueNotNumeric.
@Test
public void testDoControlIntegerMinorWhenValueNotNumeric() {
String property = "10";
String value = "five";
String msg = "At least one of the Properties is not numeric, can not compare properties!";
TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
tcsace.setControl("verifyNumericMinor");
tcsace.setValue1(property);
tcsace.setValue2(value);
tcsace.setFatal("Y");
TestCaseStepExecution tcse = new TestCaseStepExecution();
tcse.settCExecution(tCExecution);
TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();
tcsae.setTestCaseStepExecution(tcse);
tcsace.setTestCaseStepActionExecution(tcsae);
this.controlService.doControl(tcsace);
Assert.assertEquals("KO", tcsace.getReturnCode());
Assert.assertEquals("Y", tcsace.getFatal());
}
use of org.cerberus.crud.entity.TestCaseStepExecution in project cerberus-source by cerberustesting.
the class UpdateTestCaseExecution method updateTestCaseStepExecutionFromJsonArray.
/**
* update Step execution with stepArray and all the parameter belonging to it (action, control)
* @param JSONObject testCaseJson
* @param ApplicationContext appContext
* @throws JSONException
* @throws IOException
*/
String updateTestCaseStepExecutionFromJsonArray(JSONArray stepArray, ApplicationContext appContext) throws JSONException, IOException {
String returnCodeOfTestCase = "OK";
for (int i = 0; i < stepArray.length(); i++) {
JSONObject currentStep = stepArray.getJSONObject(i);
long id = currentStep.getLong("id");
String test = currentStep.getString("test");
String testCase = currentStep.getString("testcase");
int step = currentStep.getInt("step");
int index = currentStep.getInt("index");
int sort = 0;
String loop = currentStep.getString("loop");
String conditionOper = currentStep.getString("conditionOper");
String conditionVal1Init = currentStep.getString("conditionVal1Init");
String conditionVal2Init = currentStep.getString("conditionVal2Init");
String conditionVal1 = currentStep.getString("conditionVal1");
String conditionVal2 = currentStep.getString("conditionVal2");
String batNumExe = "NULL";
long start = currentStep.getLong("start");
long end = currentStep.getLong("end");
long fullStart = currentStep.getLong("fullStart");
long fullEnd = currentStep.getLong("fullEnd");
// to change
BigDecimal timeElapsed = new BigDecimal(0);
String returnCode = currentStep.getString("returnCode");
// update return code if needed
if (returnCode.equals("KO"))
returnCodeOfTestCase = "KO";
else if (returnCode.equals("FA") && !returnCodeOfTestCase.equals("KO"))
returnCodeOfTestCase = "FA";
String description = currentStep.getString("description");
// String possibly wrote by the user
String returnMessage = StringUtil.sanitize(currentStep.getString("returnMessage"));
if (// default message unchanged
returnMessage == "Step not executed")
returnMessage = "Step executed manually";
// create this testCaseStepExecution and update the bdd with it
TestCaseStepExecution currentTestCaseStepExecution = createTestCaseStepExecution(id, test, testCase, step, index, sort, loop, conditionOper, conditionVal1Init, conditionVal2Init, conditionVal1, conditionVal2, batNumExe, start, end, fullStart, fullEnd, timeElapsed, returnCode, returnMessage, description);
ITestCaseStepExecutionService testCaseStepExecutionService = appContext.getBean(ITestCaseStepExecutionService.class);
testCaseStepExecutionService.updateTestCaseStepExecution(currentTestCaseStepExecution);
// update action list belonging to the current Step
updateTestCaseStepActionFromJsonArray(currentStep.getJSONArray("actionArr"), appContext);
}
return returnCodeOfTestCase;
}
Aggregations