Search in sources :

Example 6 with TestCaseStepExecution

use of org.cerberus.crud.entity.TestCaseStepExecution 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 7 with TestCaseStepExecution

use of org.cerberus.crud.entity.TestCaseStepExecution 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 8 with TestCaseStepExecution

use of org.cerberus.crud.entity.TestCaseStepExecution 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)

Example 9 with TestCaseStepExecution

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

the class ControlServiceTest method testDoControlStringEqualWhenSuccess.

@Test
public void testDoControlStringEqualWhenSuccess() {
    String property = "test";
    String value = "test";
    String msg = "'" + property + "' is equal to '" + value + "'.";
    TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
    tcsace.setControl("verifyStringEqual");
    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(msg, tcsace.getControlResultMessage().getDescription());
    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 10 with TestCaseStepExecution

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

the class ControlServiceTest method testDoControlElementPresentWhenPropertyNull.

// @Ignore
// @Test
// public void testDoControlElementPresentWhenSuccess() {
// 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("verifyElementPresent");
// 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(true);
// 
// this.controlService.doControl(tcsace);
// 
// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());
// Assert.assertEquals("OK", tcsace.getReturnCode());
// }
// @Ignore
// @Test
// public void testDoControlElementPresentWhenFail() {
// 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("verifyElementPresent");
// 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(false);
// 
// this.controlService.doControl(tcsace);
// 
// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());
// Assert.assertEquals("KO", tcsace.getReturnCode());
// Assert.assertEquals("Y", tcsace.getFatal());
// }
@Ignore
@Test
public void testDoControlElementPresentWhenPropertyNull() {
    String property = "null";
    String value = "id=test";
    String msg = "Object is 'null'. This is mandatory in order to perform the control verify element present";
    TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
    tcsace.setControl("verifyElementPresent");
    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

TestCaseStepExecution (org.cerberus.crud.entity.TestCaseStepExecution)35 TestCaseStepActionExecution (org.cerberus.crud.entity.TestCaseStepActionExecution)28 TestCaseStepActionControlExecution (org.cerberus.crud.entity.TestCaseStepActionControlExecution)26 Test (org.junit.Test)26 IFactoryTestCaseStepExecution (org.cerberus.crud.factory.IFactoryTestCaseStepExecution)5 ArrayList (java.util.ArrayList)4 AnswerList (org.cerberus.util.answer.AnswerList)3 BigDecimal (java.math.BigDecimal)2 Connection (java.sql.Connection)2 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 SQLException (java.sql.SQLException)2 Timestamp (java.sql.Timestamp)2 Date (java.util.Date)2 TestCaseExecutionFile (org.cerberus.crud.entity.TestCaseExecutionFile)2 MessageEvent (org.cerberus.engine.entity.MessageEvent)2 CerberusEventException (org.cerberus.exception.CerberusEventException)2 Ignore (org.junit.Ignore)2 CountryEnvLink (org.cerberus.crud.entity.CountryEnvLink)1 CountryEnvParam (org.cerberus.crud.entity.CountryEnvParam)1