Search in sources :

Example 6 with TestCaseStepActionControlExecution

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

the class TestCaseStepActionExecutionService method readByVarious1WithDependency.

@Override
public AnswerList readByVarious1WithDependency(long executionId, String test, String testcase, int step, int index) {
    AnswerList actions = this.readByVarious1(executionId, test, testcase, step, index);
    AnswerList response = null;
    List<TestCaseStepActionExecution> tcsaeList = new ArrayList();
    for (Object action : actions.getDataList()) {
        TestCaseStepActionExecution tcsae = (TestCaseStepActionExecution) action;
        AnswerList controls = testCaseStepActionControlExecutionService.readByVarious1WithDependency(executionId, test, testcase, step, index, tcsae.getSequence());
        tcsae.setTestCaseStepActionControlExecutionList((List<TestCaseStepActionControlExecution>) controls.getDataList());
        AnswerList files = testCaseExecutionFileService.readByVarious(executionId, tcsae.getTest() + "-" + tcsae.getTestCase() + "-" + tcsae.getStep() + "-" + tcsae.getIndex() + "-" + tcsae.getSequence());
        tcsae.setFileList((List<TestCaseExecutionFile>) files.getDataList());
        tcsaeList.add(tcsae);
    }
    response = new AnswerList(tcsaeList, actions.getTotalRows());
    return response;
}
Also used : AnswerList(org.cerberus.util.answer.AnswerList) TestCaseStepActionControlExecution(org.cerberus.crud.entity.TestCaseStepActionControlExecution) ArrayList(java.util.ArrayList) TestCaseStepActionExecution(org.cerberus.crud.entity.TestCaseStepActionExecution) TestCaseExecutionFile(org.cerberus.crud.entity.TestCaseExecutionFile)

Example 7 with TestCaseStepActionControlExecution

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

the class ControlServiceTest method testDoControlStringDifferentWhenFail.

@Test
public void testDoControlStringDifferentWhenFail() {
    String property = "test";
    String value = "test";
    String msg = "'" + value + "' is not different from '" + property + "'.";
    TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
    tcsace.setControl("verifyStringDifferent");
    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(msg, tcsace.getControlResultMessage().getDescription());
    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 8 with TestCaseStepActionControlExecution

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

the class ControlServiceTest method testDoControlIntegerDifferentWhenSuccess.

@Test
public void testDoControlIntegerDifferentWhenSuccess() {
    String property = "5";
    String value = "10";
    String msg = "'" + property + "' is different from '" + value + "'.";
    TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
    tcsace.setControl("verifyNumericDifferent");
    tcsace.setValue1(property);
    tcsace.setValue2(value);
    TestCaseStepExecution tcse = new TestCaseStepExecution();
    tcse.settCExecution(tCExecution);
    TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();
    tcsae.setTestCaseStepExecution(tcse);
    tcsace.setTestCaseStepActionExecution(tcsae);
    this.controlService.doControl(tcsace);
    Assert.assertEquals("OK", tcsace.getReturnCode());
}
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 9 with TestCaseStepActionControlExecution

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

the class ControlServiceTest method testDoControlIntegerMinorWhenPropertyNotNumeric.

@Test
public void testDoControlIntegerMinorWhenPropertyNotNumeric() {
    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("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 10 with TestCaseStepActionControlExecution

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

the class ControlServiceTest method testDoControlIntegerGreaterWhenValueNotNumeric.

@Test
public void testDoControlIntegerGreaterWhenValueNotNumeric() {
    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("verifyNumericGreater");
    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