Search in sources :

Example 31 with TestCaseStepActionControlExecution

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

the class ControlServiceTest method testDoControlStringEqualWhenFail.

@Test
public void testDoControlStringEqualWhenFail() {
    String property = "test";
    String value = "test fail";
    String msg = "'" + property + "' is not equal to '" + value + "'.";
    TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
    tcsace.setControl("verifyStringEqual");
    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 32 with TestCaseStepActionControlExecution

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

the class ControlServiceTest method testDoControlIntegerGreaterWhenFail.

@Test
public void testDoControlIntegerGreaterWhenFail() {
    String value1 = "5";
    String value2 = "10";
    String msg = "'" + value1 + "' is not greater than '" + value2 + "'.";
    TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
    tcsace.setControl("verifyNumericGreater");
    tcsace.setValue1(value1);
    tcsace.setValue2(value2);
    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 33 with TestCaseStepActionControlExecution

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

the class ControlServiceTest method testDoControlIntegerGreaterWhenPropertyNotNumeric.

@Test
public void testDoControlIntegerGreaterWhenPropertyNotNumeric() {
    String property = "ten";
    String value = "5";
    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)

Example 34 with TestCaseStepActionControlExecution

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

the class ControlServiceTest method testDoControlIntegerEqualsWhenSuccess.

@Test
public void testDoControlIntegerEqualsWhenSuccess() {
    String property = "5";
    String value = "5";
    String msg = "'" + property + "' is equal to '" + value + "'.";
    TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
    tcsace.setControl("verifyNumericEquals");
    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 35 with TestCaseStepActionControlExecution

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

the class ControlServiceTest method testDoControlElementNotPresentWhenPropertyNull.

// @Ignore
// @Test
// public void testDoControlElementPresentWhenWebDriverException() {
// 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("verifyElementPresent");
// tcsace.setValue1(property);
// tcsace.setValue2(value);
// tcsace.setFatal("Y");
// tCExecution.setSession(session);
// TestCaseStepExecution tcse = new TestCaseStepExecution();
// tcse.settCExecution(tCExecution);
// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();
// tcsae.setTestCaseStepExecution(tcse);
// tcsace.setTestCaseStepActionExecution(tcsae);
// 
// when(webdriverService.isElementPresent(tCExecution.getSession(), 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());
// }
// @Ignore
// @Test
// public void testDoControlElementNotPresentWhenSuccess() {
// String property = "id=test";
// String value = "null";
// String msg = "Element '" + property + "' is not present on the page.";
// Identifier identifier = new Identifier();
// identifier.setIdentifier("id");
// identifier.setLocator("test");
// 
// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
// tcsace.setControl("verifyElementNotPresent");
// tcsace.setValue1(property);
// tcsace.setValue2(value);
// TestCaseStepExecution tcse = new TestCaseStepExecution();
// tcse.settCExecution(tCExecution);
// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();
// tcsae.setTestCaseStepExecution(tcse);
// tcsace.setTestCaseStepActionExecution(tcsae);
// 
// when(webdriverService.isElementPresent(session, identifier)).thenReturn(false);
// 
// this.controlService.doControl(tcsace);
// 
// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());
// Assert.assertEquals("OK", tcsace.getReturnCode());
// }
// @Ignore
// @Test
// public void testDoControlElementNotPresentWhenFail() {
// String property = "id=test";
// String value = "null";
// String msg = "Element '" + property + "' is present on the page.";
// Identifier identifier = new Identifier();
// identifier.setIdentifier("id");
// identifier.setLocator("test");
// 
// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
// tcsace.setControl("verifyElementNotPresent");
// 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)).thenReturn(true);
// 
// this.controlService.doControl(tcsace);
// 
// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());
// Assert.assertEquals("KO", tcsace.getReturnCode());
// Assert.assertEquals("Y", tcsace.getFatal());
// }
@Ignore
@Test
public void testDoControlElementNotPresentWhenPropertyNull() {
    String property = "null";
    String value = "id=test";
    String msg = "Object is 'null'. This is mandatory in order to perform the control verify element not present";
    TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
    tcsace.setControl("verifyElementNotPresent");
    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) Ignore(org.junit.Ignore) 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