Search in sources :

Example 16 with TestCaseStepActionExecution

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

the class ControlServiceTest method testDoControlIntegerEqualsWhenPropertyNotNumeric.

@Test
public void testDoControlIntegerEqualsWhenPropertyNotNumeric() {
    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("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());
}
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 17 with TestCaseStepActionExecution

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

the class ControlServiceTest method testDoControlIntegerMinorWhenSuccess.

@Test
public void testDoControlIntegerMinorWhenSuccess() {
    String property = "5";
    String value = "10";
    String msg = "'" + property + "' is minor than '" + value + "'.";
    TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
    tcsace.setControl("verifyNumericMinor");
    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 18 with TestCaseStepActionExecution

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

the class ControlServiceTest method testDoControlIntegerEqualsWhenFail.

@Test
public void testDoControlIntegerEqualsWhenFail() {
    String property = "5";
    String value = "10";
    String msg = "'" + property + "' is not equal to '" + value + "'.";
    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());
}
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 19 with TestCaseStepActionExecution

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

the class ControlServiceTest method testDoControlElementInElementWhenValueIsNull.

// @Ignore
// @Test
// public void testDoControlElementNotVisibleWhenWebDriverException() {
// String property = "id=test";
// String value = "null";
// String msg = "The test case is canceled due to lost connection to Selenium Server! Detailed error : .*";
// Identifier identifier = new Identifier();
// identifier.setIdentifier("id");
// identifier.setLocator("test");
// 
// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
// tcsace.setControl("verifyElementNotVisible");
// 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);
// 
// when(webdriverService.isElementPresent(session, identifier)).thenThrow(new WebDriverException());
// 
// this.controlService.doControl(tcsace);
// 
// Assert.assertTrue(tcsace.getControlResultMessage().getDescription().matches(msg));
// Assert.assertEquals("CA", tcsace.getReturnCode());
// Assert.assertEquals("Y", tcsace.getFatal());
// }
@Test
public void testDoControlElementInElementWhenValueIsNull() {
    String property = "id=test";
    String value = "null";
    String msg = "Element '" + value + "' is not child of element '" + property + "'.";
    TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
    tcsace.setControl("verifyElementInElement");
    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 20 with TestCaseStepActionExecution

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

the class ControlServiceTest method testDoControlElementInElementWhenPropertyIsNull.

@Test
public void testDoControlElementInElementWhenPropertyIsNull() {
    String property = "null";
    String value = "id=test";
    String msg = "Element '" + value + "' is not child of element '" + property + "'.";
    TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
    tcsace.setControl("verifyElementInElement");
    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)

Aggregations

TestCaseStepActionExecution (org.cerberus.crud.entity.TestCaseStepActionExecution)40 TestCaseStepActionControlExecution (org.cerberus.crud.entity.TestCaseStepActionControlExecution)29 TestCaseStepExecution (org.cerberus.crud.entity.TestCaseStepExecution)28 Test (org.junit.Test)26 ArrayList (java.util.ArrayList)6 IFactoryTestCaseStepActionExecution (org.cerberus.crud.factory.IFactoryTestCaseStepActionExecution)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 FileItem (org.apache.commons.fileupload.FileItem)2 FileUploadException (org.apache.commons.fileupload.FileUploadException)2 DiskFileItemFactory (org.apache.commons.fileupload.disk.DiskFileItemFactory)2 ServletFileUpload (org.apache.commons.fileupload.servlet.ServletFileUpload)2 IRecorderService (org.cerberus.engine.execution.IRecorderService)2 AnswerItem (org.cerberus.util.answer.AnswerItem)2