use of org.cerberus.crud.entity.TestCaseStepActionExecution 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.TestCaseStepActionExecution 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.TestCaseStepActionExecution 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.TestCaseStepActionExecution 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.TestCaseStepActionExecution in project cerberus-source by cerberustesting.
the class UpdateTestCaseExecution method updateTestCaseStepActionFromJsonArray.
/**
* update action execution with testCaseStepActionJson and all the parameter belonging to it (control)
* @param JSONObject testCaseJson
* @param ApplicationContext appContext
* @throws JSONException
* @throws IOException
*/
void updateTestCaseStepActionFromJsonArray(JSONArray testCaseStepActionJson, ApplicationContext appContext) throws JSONException, IOException {
for (int i = 0; i < testCaseStepActionJson.length(); i++) {
JSONObject currentAction = testCaseStepActionJson.getJSONObject(i);
long id = currentAction.getLong("id");
String test = currentAction.getString("test");
String testCase = currentAction.getString("testcase");
int step = currentAction.getInt("step");
int index = currentAction.getInt("index");
int sort = currentAction.getInt("sort");
int sequence = currentAction.getInt("sequence");
String conditionOper = currentAction.getString("conditionOper");
String conditionVal1Init = currentAction.getString("conditionVal1Init");
String conditionVal2Init = currentAction.getString("conditionVal2Init");
String conditionVal1 = currentAction.getString("conditionVal1");
String conditionVal2 = currentAction.getString("conditionVal2");
String action = currentAction.getString("action");
String value1Init = currentAction.getString("value1init");
String value2Init = currentAction.getString("value2init");
String value1 = currentAction.getString("value1");
String value2 = currentAction.getString("value2");
String forceExeStatus = currentAction.getString("forceExeStatus");
String description = currentAction.getString("description");
String returnCode = currentAction.getString("returnCode");
// String wrote by the user
String returnMessage = StringUtil.sanitize(currentAction.getString("returnMessage"));
// default message unchanged
if (returnMessage.equals("Action not executed"))
returnMessage = "Action executed manually";
long start = currentAction.getLong("start");
long end = currentAction.getLong("end");
// currentAction.getLong("fullStart");
long fullStart = 0;
// currentAction.getLong("fullEnd");
long fullEnd = 0;
// create this testCaseStepActionExecution and update the bdd with it
TestCaseStepActionExecution currentTestCaseStepActionExecution = createTestCaseStepActionExecution(id, test, testCase, step, index, sequence, sort, returnCode, returnMessage, conditionOper, conditionVal1Init, conditionVal2Init, conditionVal1, conditionVal2, action, value1Init, value2Init, value1, value2, forceExeStatus, start, end, fullStart, fullEnd, null, description, null, null);
ITestCaseStepActionExecutionService testCaseStepActionExecutionService = appContext.getBean(ITestCaseStepActionExecutionService.class);
testCaseStepActionExecutionService.updateTestCaseStepActionExecution(currentTestCaseStepActionExecution);
// update the control list belonging to the current Action
updateTestCaseStepActionControlExecutionFromJsonArray(currentAction.getJSONArray("controlArr"), appContext);
}
}
Aggregations