Search in sources :

Example 21 with TestCaseStepActionControlExecution

use of org.cerberus.crud.entity.TestCaseStepActionControlExecution 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());
}
Also used : TestCaseStepExecution(org.cerberus.crud.entity.TestCaseStepExecution) TestCaseStepActionControlExecution(org.cerberus.crud.entity.TestCaseStepActionControlExecution) TestCaseStepActionExecution(org.cerberus.crud.entity.TestCaseStepActionExecution) Test(org.junit.Test)

Example 22 with TestCaseStepActionControlExecution

use of org.cerberus.crud.entity.TestCaseStepActionControlExecution in project cerberus-source by cerberustesting.

the class UpdateTestCaseExecution method createTestCaseStepActionControlExecution.

// create a TestCaseStepActionControlExecution with the parameters
private TestCaseStepActionControlExecution createTestCaseStepActionControlExecution(long id, String test, String testCase, int step, int index, int sequence, int controlSequence, int sort, String returnCode, String returnMessage, String conditionOper, String conditionVal1Init, String conditionVal2Init, String conditionVal1, String conditionVal2, String control, String value1Init, String value2Init, String value1, String value2, String fatal, long start, long end, long startLong, long endLong, String description, TestCaseStepActionExecution testCaseStepActionExecution, MessageEvent resultMessage) {
    TestCaseStepActionControlExecution testCaseStepActionControlExecution = new TestCaseStepActionControlExecution();
    testCaseStepActionControlExecution.setId(id);
    testCaseStepActionControlExecution.setTest(test);
    testCaseStepActionControlExecution.setTestCase(testCase);
    testCaseStepActionControlExecution.setStep(step);
    testCaseStepActionControlExecution.setIndex(index);
    testCaseStepActionControlExecution.setSequence(sequence);
    testCaseStepActionControlExecution.setControlSequence(controlSequence);
    testCaseStepActionControlExecution.setSort(sort);
    testCaseStepActionControlExecution.setReturnCode(returnCode);
    testCaseStepActionControlExecution.setReturnMessage(returnMessage);
    testCaseStepActionControlExecution.setConditionOper(conditionOper);
    testCaseStepActionControlExecution.setConditionVal1Init(conditionVal1Init);
    testCaseStepActionControlExecution.setConditionVal2Init(conditionVal2Init);
    testCaseStepActionControlExecution.setConditionVal1(conditionVal1);
    testCaseStepActionControlExecution.setConditionVal2(conditionVal2);
    testCaseStepActionControlExecution.setControl(control);
    testCaseStepActionControlExecution.setValue1(value1);
    testCaseStepActionControlExecution.setValue2(value2);
    testCaseStepActionControlExecution.setValue1Init(value1Init);
    testCaseStepActionControlExecution.setValue2Init(value2Init);
    testCaseStepActionControlExecution.setFatal(fatal);
    testCaseStepActionControlExecution.setStart(start);
    testCaseStepActionControlExecution.setEnd(end);
    testCaseStepActionControlExecution.setStartLong(startLong);
    testCaseStepActionControlExecution.setEndLong(endLong);
    testCaseStepActionControlExecution.setTestCaseStepActionExecution(testCaseStepActionExecution);
    testCaseStepActionControlExecution.setControlResultMessage(resultMessage);
    testCaseStepActionControlExecution.setDescription(description);
    return testCaseStepActionControlExecution;
}
Also used : TestCaseStepActionControlExecution(org.cerberus.crud.entity.TestCaseStepActionControlExecution)

Example 23 with TestCaseStepActionControlExecution

use of org.cerberus.crud.entity.TestCaseStepActionControlExecution in project cerberus-source by cerberustesting.

the class UpdateTestCaseExecution method updateTestCaseStepActionControlExecutionFromJsonArray.

/**
 * update control execution with testCaseStepActionControlJson
 * @param JSONObject testCaseJson
 * @param ApplicationContext appContext
 * @throws JSONException
 * @throws IOException
 */
void updateTestCaseStepActionControlExecutionFromJsonArray(JSONArray controlArray, ApplicationContext appContext) throws JSONException, IOException {
    for (int i = 0; i < controlArray.length(); i++) {
        JSONObject currentControl = controlArray.getJSONObject(i);
        long id = currentControl.getLong("id");
        String test = currentControl.getString("test");
        String testCase = currentControl.getString("testcase");
        int step = currentControl.getInt("step");
        int index = currentControl.getInt("index");
        int sort = currentControl.getInt("sort");
        int sequence = currentControl.getInt("sequence");
        int controlSequence = currentControl.getInt("control");
        String conditionOper = currentControl.getString("conditionOper");
        String conditionVal1Init = currentControl.getString("conditionVal1Init");
        String conditionVal2Init = currentControl.getString("conditionVal2Init");
        String conditionVal1 = currentControl.getString("conditionVal1");
        String conditionVal2 = currentControl.getString("conditionVal2");
        String control = currentControl.getString("controlType");
        String value1Init = currentControl.getString("value1init");
        String value2Init = currentControl.getString("value2init");
        String value1 = currentControl.getString("value1");
        String value2 = currentControl.getString("value2");
        String fatal = currentControl.getString("fatal");
        String description = currentControl.getString("description");
        String returnCode = currentControl.getString("returnCode");
        // String wrote by the user
        String returnMessage = StringUtil.sanitize(currentControl.getString("returnMessage"));
        if (// default message unchanged
        returnMessage.equals("Control executed manually"))
            returnMessage = "Control executed manually";
        long start = currentControl.getLong("start");
        long end = currentControl.getLong("end");
        // currentAction.getLong("fullStart");
        long fullStart = 0;
        // currentAction.getLong("fullEnd");
        long fullEnd = 0;
        // create this TestCaseStepActionControlExecution and update the bdd with it
        TestCaseStepActionControlExecution currentTestCaseStepActionControlExecution = createTestCaseStepActionControlExecution(id, test, testCase, step, index, sequence, controlSequence, sort, returnCode, returnMessage, conditionOper, conditionVal1Init, conditionVal2Init, conditionVal1, conditionVal2, control, value1Init, value2Init, value1, value2, fatal, start, end, fullStart, fullEnd, description, null, null);
        ITestCaseStepActionControlExecutionService testCaseStepActionControlExecutionService = appContext.getBean(ITestCaseStepActionControlExecutionService.class);
        testCaseStepActionControlExecutionService.updateTestCaseStepActionControlExecution(currentTestCaseStepActionControlExecution);
    }
}
Also used : ITestCaseStepActionControlExecutionService(org.cerberus.crud.service.ITestCaseStepActionControlExecutionService) JSONObject(org.json.JSONObject) TestCaseStepActionControlExecution(org.cerberus.crud.entity.TestCaseStepActionControlExecution)

Example 24 with TestCaseStepActionControlExecution

use of org.cerberus.crud.entity.TestCaseStepActionControlExecution in project cerberus-source by cerberustesting.

the class FactoryTestCaseStepActionExecution method create.

@Override
public TestCaseStepActionExecution create(long id, String test, String testCase, int step, int index, int sequence, int sort, String returnCode, String returnMessage, String conditionOper, String conditionVal1Init, String conditionVal2Init, String conditionVal1, String conditionVal2, String action, String value1Init, String value2Init, String value1, String value2, String forceExeStatus, long start, long end, long startLong, long endLong, MessageEvent resultMessage, String description, TestCaseStepAction testCaseStepAction, TestCaseStepExecution testCaseStepExecution) {
    TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();
    testCaseStepActionExecution.setAction(action);
    testCaseStepActionExecution.setEnd(end);
    testCaseStepActionExecution.setEndLong(endLong);
    testCaseStepActionExecution.setId(id);
    testCaseStepActionExecution.setConditionOper(conditionOper);
    testCaseStepActionExecution.setConditionVal1Init(conditionVal1Init);
    testCaseStepActionExecution.setConditionVal2Init(conditionVal2Init);
    testCaseStepActionExecution.setConditionVal1(conditionVal1);
    testCaseStepActionExecution.setConditionVal2(conditionVal2);
    testCaseStepActionExecution.setValue1(value1);
    testCaseStepActionExecution.setValue2(value2);
    testCaseStepActionExecution.setValue1Init(value1Init);
    testCaseStepActionExecution.setValue2Init(value2Init);
    testCaseStepActionExecution.setForceExeStatus(forceExeStatus);
    testCaseStepActionExecution.setReturnCode(returnCode);
    testCaseStepActionExecution.setReturnMessage(returnMessage);
    testCaseStepActionExecution.setSequence(sequence);
    testCaseStepActionExecution.setSort(sort);
    testCaseStepActionExecution.setStart(start);
    testCaseStepActionExecution.setStartLong(startLong);
    testCaseStepActionExecution.setStep(step);
    testCaseStepActionExecution.setIndex(index);
    testCaseStepActionExecution.setTest(test);
    testCaseStepActionExecution.setTestCase(testCase);
    testCaseStepActionExecution.setActionResultMessage(resultMessage);
    testCaseStepActionExecution.setTestCaseStepAction(testCaseStepAction);
    testCaseStepActionExecution.setTestCaseStepExecution(testCaseStepExecution);
    testCaseStepActionExecution.setDescription(description);
    // List objects
    List<TestCaseExecutionFile> objectFileList = new ArrayList<>();
    testCaseStepActionExecution.setFileList(objectFileList);
    List<TestCaseStepActionControlExecution> testCaseStepActionControlExecution = new ArrayList<>();
    testCaseStepActionExecution.setTestCaseStepActionControlExecutionList(testCaseStepActionControlExecution);
    return testCaseStepActionExecution;
}
Also used : TestCaseStepActionControlExecution(org.cerberus.crud.entity.TestCaseStepActionControlExecution) ArrayList(java.util.ArrayList) IFactoryTestCaseStepActionExecution(org.cerberus.crud.factory.IFactoryTestCaseStepActionExecution) TestCaseStepActionExecution(org.cerberus.crud.entity.TestCaseStepActionExecution) TestCaseExecutionFile(org.cerberus.crud.entity.TestCaseExecutionFile)

Example 25 with TestCaseStepActionControlExecution

use of org.cerberus.crud.entity.TestCaseStepActionControlExecution in project cerberus-source by cerberustesting.

the class ControlServiceTest method testDoControlIntegerMinorWhenFail.

@Test
public void testDoControlIntegerMinorWhenFail() {
    String property = "10";
    String value = "5";
    String msg = "'" + property + "' is not minor than '" + value + "'.";
    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());
}
Also used : TestCaseStepExecution(org.cerberus.crud.entity.TestCaseStepExecution) TestCaseStepActionControlExecution(org.cerberus.crud.entity.TestCaseStepActionControlExecution) TestCaseStepActionExecution(org.cerberus.crud.entity.TestCaseStepActionExecution) Test(org.junit.Test)

Aggregations

TestCaseStepActionControlExecution (org.cerberus.crud.entity.TestCaseStepActionControlExecution)39 TestCaseStepActionExecution (org.cerberus.crud.entity.TestCaseStepActionExecution)29 TestCaseStepExecution (org.cerberus.crud.entity.TestCaseStepExecution)26 Test (org.junit.Test)26 ArrayList (java.util.ArrayList)5 IFactoryTestCaseStepActionControlExecution (org.cerberus.crud.factory.IFactoryTestCaseStepActionControlExecution)5 TestCaseExecutionFile (org.cerberus.crud.entity.TestCaseExecutionFile)4 MessageEvent (org.cerberus.engine.entity.MessageEvent)4 Connection (java.sql.Connection)3 PreparedStatement (java.sql.PreparedStatement)3 ResultSet (java.sql.ResultSet)3 SQLException (java.sql.SQLException)3 AnswerList (org.cerberus.util.answer.AnswerList)3 JSONObject (org.json.JSONObject)3 AnswerItem (org.cerberus.util.answer.AnswerItem)2 Ignore (org.junit.Ignore)2 Gson (com.google.gson.Gson)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 FileItem (org.apache.commons.fileupload.FileItem)1