use of org.cerberus.crud.entity.TestCaseStepActionControlExecution in project cerberus-source by cerberustesting.
the class ControlServiceTest method testVerifyElementEqualsWithNotCompatibleApplication.
// @Ignore
// @Test
// public void testDoControlElementInElementWhenValueIsNotChildOfProperty() {
// String property = "id=parent";
// String value = "id=child";
// String msg = "Element '" + value + "' is not child of element '" + property + "'.";
// Identifier identifier = new Identifier();
// identifier.setIdentifier("id");
// identifier.setLocator("test");
// Identifier identifierValue = new Identifier();
// identifier.setIdentifier("id");
// identifier.setLocator("test2");
//
// when(webdriverService.isElementInElement(session, identifier, identifierValue)).thenReturn(Boolean.FALSE);
//
// 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());
// }
//
// @Ignore
// @Test
// public void testDoControlElementInElementWhenValueIsChildOfProperty() {
// String property = "id=parent";
// String value = "id=child";
// String msg = "Element '" + value + "' in child of element '" + property + "'.";
// Identifier identifier = new Identifier();
// identifier.setIdentifier("id");
// identifier.setLocator("test");
// Identifier identifierValue = new Identifier();
// identifier.setIdentifier("id");
// identifier.setLocator("test2");
//
// when(webdriverService.isElementInElement(session, identifier, identifierValue)).thenReturn(Boolean.TRUE);
//
// 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("OK", tcsace.getReturnCode());
// Assert.assertEquals("Y", tcsace.getFatal());
// }
@Test
public void testVerifyElementEqualsWithNotCompatibleApplication() {
String xpath = "/foo/bar";
String expectedElement = "<bar>baz</bar>";
TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
tcsace.setControl("verifyElementEquals");
tcsace.setValue1(xpath);
tcsace.setValue2(expectedElement);
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(MessageEventEnum.CONTROL_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION.getCode(), tcsace.getControlResultMessage().getCode());
}
use of org.cerberus.crud.entity.TestCaseStepActionControlExecution in project cerberus-source by cerberustesting.
the class ControlServiceTest method testDoControlElementNotVisibleWhenPropertyNull.
// @Ignore
// @Test
// public void testDoControlElementNotPresentWhenWebDriverException() {
// 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("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)).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 testDoControlElementNotVisibleWhenSuccess() {
// String property = "id=test";
// String value = "null";
// String msg = "Element '" + property + "' is present and not visible on the page.";
// 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)).thenReturn(true);
// when(webdriverService.isElementNotVisible(session, identifier)).thenReturn(true);
//
// this.controlService.doControl(tcsace);
//
// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());
// Assert.assertEquals("OK", tcsace.getReturnCode());
// }
//
// @Ignore
// @Test
// public void testDoControlElementNotVisibleWhenFail() {
// String property = "id=test";
// String value = "null";
// String msg = "Element '" + property + "' is visible on the page.";
// 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)).thenReturn(true);
// when(webdriverService.isElementNotVisible(session, identifier)).thenReturn(false);
//
// this.controlService.doControl(tcsace);
//
// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());
// Assert.assertEquals("KO", tcsace.getReturnCode());
// Assert.assertEquals("Y", tcsace.getFatal());
// }
@Test
public void testDoControlElementNotVisibleWhenPropertyNull() {
String property = "null";
String value = "id=test";
String msg = "Object is 'null'. This is mandatory in order to perform the control verify element not visible";
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);
this.controlService.doControl(tcsace);
Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());
Assert.assertEquals("KO", tcsace.getReturnCode());
Assert.assertEquals("Y", tcsace.getFatal());
}
use of org.cerberus.crud.entity.TestCaseStepActionControlExecution in project cerberus-source by cerberustesting.
the class ControlServiceTest method testDoControlIntegerGreaterWhenSuccess.
@Test
public void testDoControlIntegerGreaterWhenSuccess() {
String property = "10";
String value = "5";
String msg = "'" + property + "' is greater than '" + value + "'.";
TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
tcsace.setControl("verifyNumericGreater");
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());
}
use of org.cerberus.crud.entity.TestCaseStepActionControlExecution in project cerberus-source by cerberustesting.
the class ControlServiceTest method testDoControlStringDifferentWhenSuccess.
@Test
public void testDoControlStringDifferentWhenSuccess() {
String property = "test";
String value = "test success";
String msg = "'" + property + "' is different from '" + value + "'.";
TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
tcsace.setControl("verifyStringDifferent");
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());
}
use of org.cerberus.crud.entity.TestCaseStepActionControlExecution in project cerberus-source by cerberustesting.
the class ControlServiceTest method testDoControlIntegerDifferentWhenFail.
@Test
public void testDoControlIntegerDifferentWhenFail() {
String property = "5";
String value = "5";
String msg = "'" + property + "' is not different from '" + value + "'.";
TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();
tcsace.setControl("verifyNumericDifferent");
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());
}
Aggregations