How to use doControl method of org.cerberus.engine.gwt.impl.ControlService class

Best Cerberus-source code snippet using org.cerberus.engine.gwt.impl.ControlService.doControl

Source:ControlService.java Github

copy

Full Screen

...81 private IVariableService variableService;82 @Autowired83 private IRobotServerService robotServerService;84 @Override85 public TestCaseStepActionControlExecution doControl(TestCaseStepActionControlExecution controlExecution) {86 MessageEvent res;87 TestCaseExecution execution = controlExecution.getTestCaseStepActionExecution().getTestCaseStepExecution().gettCExecution();88 AnswerItem<String> answerDecode = new AnswerItem<>();89 // Decode the step action control description90 try {91 // When starting a new control, we reset the property list that was already calculated.92 execution.setRecursiveAlreadyCalculatedPropertiesList(new ArrayList<>());93 answerDecode = variableService.decodeStringCompletly(controlExecution.getDescription(),94 execution, controlExecution.getTestCaseStepActionExecution(), false);95 controlExecution.setDescription(answerDecode.getItem());96 if (!(answerDecode.isCodeStringEquals("OK"))) {97 // If anything wrong with the decode --> we stop here with decode message in the control result.98 controlExecution.setControlResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Description"));99 controlExecution.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));100 controlExecution.setStopExecution(answerDecode.getResultMessage().isStopTest());101 controlExecution.setEnd(new Date().getTime());102 LOG.debug("Control interrupted due to decode 'Description' Error.");103 return controlExecution;104 }105 } catch (CerberusEventException cex) {106 controlExecution.setControlResultMessage(cex.getMessageError());107 controlExecution.setExecutionResultMessage(new MessageGeneral(cex.getMessageError().getMessage()));108 return controlExecution;109 }110 //Decode the 2 fields property and values before doing the control.111 try {112 // for both control property and control value113 //if the getvalue() indicates that the execution should stop then we stop it before the doControl or114 //if the property service was unable to decode the property that is specified in the object,115 //then the execution of this control should not performed116 if (controlExecution.getValue1() == null) {117 controlExecution.setValue1("");118 }119 if (controlExecution.getValue1().contains("%")) {120 // When starting a new control, we reset the property list that was already calculated.121 execution.setRecursiveAlreadyCalculatedPropertiesList(new ArrayList<>());122 answerDecode = variableService.decodeStringCompletly(controlExecution.getValue1(), execution,123 controlExecution.getTestCaseStepActionExecution(), false);124 controlExecution.setValue1(answerDecode.getItem());125 if (!(answerDecode.isCodeStringEquals("OK"))) {126 // If anything wrong with the decode --> we stop here with decode message in the control result.127 controlExecution.setControlResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Control Value1"));...

Full Screen

Full Screen

Source:ControlServiceTest.java Github

copy

Full Screen

...89 tcse.settCExecution(tCExecution);90 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();91 tcsae.setTestCaseStepExecution(tcse);92 tcsace.setTestCaseStepActionExecution(tcsae);93 this.controlService.doControl(tcsace);94 Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());95 Assert.assertEquals("OK", tcsace.getReturnCode());96 }97 @Test98 public void testDoControlStringEqualWhenFail() {99 String property = "test";100 String value = "test fail";101 String msg = "'" + property + "' is not equal to '" + value + "'.";102 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();103 tcsace.setControl("verifyStringEqual");104 tcsace.setValue1(property);105 tcsace.setValue2(value);106 tcsace.setFatal("Y");107 TestCaseStepExecution tcse = new TestCaseStepExecution();108 tcse.settCExecution(tCExecution);109 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();110 tcsae.setTestCaseStepExecution(tcse);111 tcsace.setTestCaseStepActionExecution(tcsae);112 this.controlService.doControl(tcsace);113 Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());114 Assert.assertEquals("KO", tcsace.getReturnCode());115 Assert.assertEquals("Y", tcsace.getFatal());116 }117 @Test118 public void testDoControlStringDifferentWhenSuccess() {119 String property = "test";120 String value = "test success";121 String msg = "'" + property + "' is different from '" + value + "'.";122 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();123 tcsace.setControl("verifyStringDifferent");124 tcsace.setValue1(property);125 tcsace.setValue2(value);126 TestCaseStepExecution tcse = new TestCaseStepExecution();127 tcse.settCExecution(tCExecution);128 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();129 tcsae.setTestCaseStepExecution(tcse);130 tcsace.setTestCaseStepActionExecution(tcsae);131 this.controlService.doControl(tcsace);132 Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());133 Assert.assertEquals("OK", tcsace.getReturnCode());134 }135 @Test136 public void testDoControlStringDifferentWhenFail() {137 String property = "test";138 String value = "test";139 String msg = "'" + value + "' is not different from '" + property + "'.";140 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();141 tcsace.setControl("verifyStringDifferent");142 tcsace.setValue1(property);143 tcsace.setValue2(value);144 tcsace.setFatal("Y");145 TestCaseStepExecution tcse = new TestCaseStepExecution();146 tcse.settCExecution(tCExecution);147 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();148 tcsae.setTestCaseStepExecution(tcse);149 tcsace.setTestCaseStepActionExecution(tcsae);150 this.controlService.doControl(tcsace);151 Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());152 Assert.assertEquals("KO", tcsace.getReturnCode());153 Assert.assertEquals("Y", tcsace.getFatal());154 }155 @Test156 public void testDoControlIntegerGreaterWhenSuccess() {157 String property = "10";158 String value = "5";159 String msg = "'" + property + "' is greater than '" + value + "'.";160 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();161 tcsace.setControl("verifyNumericGreater");162 tcsace.setValue1(property);163 tcsace.setValue2(value);164 TestCaseStepExecution tcse = new TestCaseStepExecution();165 tcse.settCExecution(tCExecution);166 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();167 tcsae.setTestCaseStepExecution(tcse);168 tcsace.setTestCaseStepActionExecution(tcsae);169 this.controlService.doControl(tcsace);170 Assert.assertEquals("OK", tcsace.getReturnCode());171 }172 @Test173 public void testDoControlIntegerGreaterWhenFail() {174 String value1 = "5";175 String value2 = "10";176 String msg = "'" + value1 + "' is not greater than '" + value2 + "'.";177 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();178 tcsace.setControl("verifyNumericGreater");179 tcsace.setValue1(value1);180 tcsace.setValue2(value2);181 tcsace.setFatal("Y");182 TestCaseStepExecution tcse = new TestCaseStepExecution();183 tcse.settCExecution(tCExecution);184 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();185 tcsae.setTestCaseStepExecution(tcse);186 tcsace.setTestCaseStepActionExecution(tcsae);187 this.controlService.doControl(tcsace);188 Assert.assertEquals("KO", tcsace.getReturnCode());189 Assert.assertEquals("Y", tcsace.getFatal());190 }191 @Test192 public void testDoControlIntegerGreaterWhenPropertyNotNumeric() {193 String property = "ten";194 String value = "5";195 String msg = "At least one of the Properties is not numeric, can not compare properties!";196 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();197 tcsace.setControl("verifyNumericGreater");198 tcsace.setValue1(property);199 tcsace.setValue2(value);200 tcsace.setFatal("Y");201 TestCaseStepExecution tcse = new TestCaseStepExecution();202 tcse.settCExecution(tCExecution);203 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();204 tcsae.setTestCaseStepExecution(tcse);205 tcsace.setTestCaseStepActionExecution(tcsae);206 this.controlService.doControl(tcsace);207 Assert.assertEquals("KO", tcsace.getReturnCode());208 Assert.assertEquals("Y", tcsace.getFatal());209 }210 @Test211 public void testDoControlIntegerGreaterWhenValueNotNumeric() {212 String property = "10";213 String value = "five";214 String msg = "At least one of the Properties is not numeric, can not compare properties!";215 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();216 tcsace.setControl("verifyNumericGreater");217 tcsace.setValue1(property);218 tcsace.setValue2(value);219 tcsace.setFatal("Y");220 TestCaseStepExecution tcse = new TestCaseStepExecution();221 tcse.settCExecution(tCExecution);222 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();223 tcsae.setTestCaseStepExecution(tcse);224 tcsace.setTestCaseStepActionExecution(tcsae);225 this.controlService.doControl(tcsace);226 Assert.assertEquals("KO", tcsace.getReturnCode());227 Assert.assertEquals("Y", tcsace.getFatal());228 }229 @Test230 public void testDoControlIntegerMinorWhenSuccess() {231 String property = "5";232 String value = "10";233 String msg = "'" + property + "' is minor than '" + value + "'.";234 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();235 tcsace.setControl("verifyNumericMinor");236 tcsace.setValue1(property);237 tcsace.setValue2(value);238 TestCaseStepExecution tcse = new TestCaseStepExecution();239 tcse.settCExecution(tCExecution);240 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();241 tcsae.setTestCaseStepExecution(tcse);242 tcsace.setTestCaseStepActionExecution(tcsae);243 this.controlService.doControl(tcsace);244 Assert.assertEquals("OK", tcsace.getReturnCode());245 }246 @Test247 public void testDoControlIntegerMinorWhenFail() {248 String property = "10";249 String value = "5";250 String msg = "'" + property + "' is not minor than '" + value + "'.";251 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();252 tcsace.setControl("verifyNumericMinor");253 tcsace.setValue1(property);254 tcsace.setValue2(value);255 tcsace.setFatal("Y");256 TestCaseStepExecution tcse = new TestCaseStepExecution();257 tcse.settCExecution(tCExecution);258 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();259 tcsae.setTestCaseStepExecution(tcse);260 tcsace.setTestCaseStepActionExecution(tcsae);261 this.controlService.doControl(tcsace);262 Assert.assertEquals("KO", tcsace.getReturnCode());263 Assert.assertEquals("Y", tcsace.getFatal());264 }265 @Test266 public void testDoControlIntegerMinorWhenPropertyNotNumeric() {267 String property = "five";268 String value = "5";269 String msg = "At least one of the Properties is not numeric, can not compare properties!";270 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();271 tcsace.setControl("verifyNumericMinor");272 tcsace.setValue1(property);273 tcsace.setValue2(value);274 tcsace.setFatal("Y");275 TestCaseStepExecution tcse = new TestCaseStepExecution();276 tcse.settCExecution(tCExecution);277 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();278 tcsae.setTestCaseStepExecution(tcse);279 tcsace.setTestCaseStepActionExecution(tcsae);280 this.controlService.doControl(tcsace);281 Assert.assertEquals("KO", tcsace.getReturnCode());282 Assert.assertEquals("Y", tcsace.getFatal());283 }284 @Test285 public void testDoControlIntegerMinorWhenValueNotNumeric() {286 String property = "10";287 String value = "five";288 String msg = "At least one of the Properties is not numeric, can not compare properties!";289 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();290 tcsace.setControl("verifyNumericMinor");291 tcsace.setValue1(property);292 tcsace.setValue2(value);293 tcsace.setFatal("Y");294 TestCaseStepExecution tcse = new TestCaseStepExecution();295 tcse.settCExecution(tCExecution);296 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();297 tcsae.setTestCaseStepExecution(tcse);298 tcsace.setTestCaseStepActionExecution(tcsae);299 this.controlService.doControl(tcsace);300 Assert.assertEquals("KO", tcsace.getReturnCode());301 Assert.assertEquals("Y", tcsace.getFatal());302 }303 @Test304 public void testDoControlIntegerEqualsWhenSuccess() {305 String property = "5";306 String value = "5";307 String msg = "'" + property + "' is equal to '" + value + "'.";308 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();309 tcsace.setControl("verifyNumericEquals");310 tcsace.setValue1(property);311 tcsace.setValue2(value);312 TestCaseStepExecution tcse = new TestCaseStepExecution();313 tcse.settCExecution(tCExecution);314 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();315 tcsae.setTestCaseStepExecution(tcse);316 tcsace.setTestCaseStepActionExecution(tcsae);317 this.controlService.doControl(tcsace);318 Assert.assertEquals("OK", tcsace.getReturnCode());319 }320 @Test321 public void testDoControlIntegerEqualsWhenFail() {322 String property = "5";323 String value = "10";324 String msg = "'" + property + "' is not equal to '" + value + "'.";325 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();326 tcsace.setControl("verifyNumericEquals");327 tcsace.setValue1(property);328 tcsace.setValue2(value);329 tcsace.setFatal("Y");330 TestCaseStepExecution tcse = new TestCaseStepExecution();331 tcse.settCExecution(tCExecution);332 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();333 tcsae.setTestCaseStepExecution(tcse);334 tcsace.setTestCaseStepActionExecution(tcsae);335 this.controlService.doControl(tcsace);336 Assert.assertEquals("KO", tcsace.getReturnCode());337 Assert.assertEquals("Y", tcsace.getFatal());338 }339 @Test340 public void testDoControlIntegerEqualsWhenPropertyNotNumeric() {341 String property = "five";342 String value = "5";343 String msg = "At least one of the Properties is not numeric, can not compare properties!";344 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();345 tcsace.setControl("verifyNumericEquals");346 tcsace.setValue1(property);347 tcsace.setValue2(value);348 tcsace.setFatal("Y");349 TestCaseStepExecution tcse = new TestCaseStepExecution();350 tcse.settCExecution(tCExecution);351 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();352 tcsae.setTestCaseStepExecution(tcse);353 tcsace.setTestCaseStepActionExecution(tcsae);354 this.controlService.doControl(tcsace);355 Assert.assertEquals("KO", tcsace.getReturnCode());356 Assert.assertEquals("Y", tcsace.getFatal());357 }358 @Test359 public void testDoControlIntegerEqualsWhenValueNotNumeric() {360 String property = "10";361 String value = "five";362 String msg = "At least one of the Properties is not numeric, can not compare properties!";363 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();364 tcsace.setControl("verifyNumericEquals");365 tcsace.setValue1(property);366 tcsace.setValue2(value);367 tcsace.setFatal("Y");368 TestCaseStepExecution tcse = new TestCaseStepExecution();369 tcse.settCExecution(tCExecution);370 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();371 tcsae.setTestCaseStepExecution(tcse);372 tcsace.setTestCaseStepActionExecution(tcsae);373 this.controlService.doControl(tcsace);374 Assert.assertEquals("KO", tcsace.getReturnCode());375 Assert.assertEquals("Y", tcsace.getFatal());376 }377 @Test378 public void testDoControlIntegerDifferentWhenSuccess() {379 String property = "5";380 String value = "10";381 String msg = "'" + property + "' is different from '" + value + "'.";382 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();383 tcsace.setControl("verifyNumericDifferent");384 tcsace.setValue1(property);385 tcsace.setValue2(value);386 TestCaseStepExecution tcse = new TestCaseStepExecution();387 tcse.settCExecution(tCExecution);388 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();389 tcsae.setTestCaseStepExecution(tcse);390 tcsace.setTestCaseStepActionExecution(tcsae);391 this.controlService.doControl(tcsace);392 Assert.assertEquals("OK", tcsace.getReturnCode());393 }394 @Test395 public void testDoControlIntegerDifferentWhenFail() {396 String property = "5";397 String value = "5";398 String msg = "'" + property + "' is not different from '" + value + "'.";399 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();400 tcsace.setControl("verifyNumericDifferent");401 tcsace.setValue1(property);402 tcsace.setValue2(value);403 tcsace.setFatal("Y");404 TestCaseStepExecution tcse = new TestCaseStepExecution();405 tcse.settCExecution(tCExecution);406 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();407 tcsae.setTestCaseStepExecution(tcse);408 tcsace.setTestCaseStepActionExecution(tcsae);409 this.controlService.doControl(tcsace);410 Assert.assertEquals("KO", tcsace.getReturnCode());411 Assert.assertEquals("Y", tcsace.getFatal());412 }413 @Test414 public void testDoControlIntegerDifferentWhenPropertyNotNumeric() {415 String property = "five";416 String value = "5";417 String msg = "At least one of the Properties is not numeric, can not compare properties!";418 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();419 tcsace.setControl("verifyNumericDifferent");420 tcsace.setValue1(property);421 tcsace.setValue2(value);422 tcsace.setFatal("Y");423 TestCaseStepExecution tcse = new TestCaseStepExecution();424 tcse.settCExecution(tCExecution);425 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();426 tcsae.setTestCaseStepExecution(tcse);427 tcsace.setTestCaseStepActionExecution(tcsae);428 this.controlService.doControl(tcsace);429 Assert.assertEquals("KO", tcsace.getReturnCode());430 Assert.assertEquals("Y", tcsace.getFatal());431 }432 @Test433 public void testDoControlIntegerDifferentWhenValueNotNumeric() {434 String property = "10";435 String value = "five";436 String msg = "At least one of the Properties is not numeric, can not compare properties!";437 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();438 tcsace.setControl("verifyNumericDifferent");439 tcsace.setValue1(property);440 tcsace.setValue2(value);441 tcsace.setFatal("Y");442 TestCaseStepExecution tcse = new TestCaseStepExecution();443 tcse.settCExecution(tCExecution);444 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();445 tcsae.setTestCaseStepExecution(tcse);446 tcsace.setTestCaseStepActionExecution(tcsae);447 this.controlService.doControl(tcsace);448 Assert.assertEquals("KO", tcsace.getReturnCode());449 Assert.assertEquals("Y", tcsace.getFatal());450 }451// @Ignore452// @Test453// public void testDoControlElementPresentWhenSuccess() {454// String property = "id=test";455// String value = "null";456// String msg = "Element '" + property + "' is present on the page.";457// Identifier identifier = new Identifier();458// identifier.setIdentifier("id");459// identifier.setLocator("test");460//461// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();462// tcsace.setControl("verifyElementPresent");463// tcsace.setValue1(property);464// tcsace.setValue2(value);465// TestCaseStepExecution tcse = new TestCaseStepExecution();466// tcse.settCExecution(tCExecution);467// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();468// tcsae.setTestCaseStepExecution(tcse);469// tcsace.setTestCaseStepActionExecution(tcsae);470//471// when(webdriverService.isElementPresent(session, identifier)).thenReturn(true);472//473// this.controlService.doControl(tcsace);474//475// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());476// Assert.assertEquals("OK", tcsace.getReturnCode());477// }478// @Ignore479// @Test480// public void testDoControlElementPresentWhenFail() {481// String property = "id=test";482// String value = "null";483// String msg = "Element '" + property + "' is not present on the page.";484// Identifier identifier = new Identifier();485// identifier.setIdentifier("id");486// identifier.setLocator("test");487//488// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();489// tcsace.setControl("verifyElementPresent");490// tcsace.setValue1(property);491// tcsace.setValue2(value);492// tcsace.setFatal("Y");493// TestCaseStepExecution tcse = new TestCaseStepExecution();494// tcse.settCExecution(tCExecution);495// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();496// tcsae.setTestCaseStepExecution(tcse);497// tcsace.setTestCaseStepActionExecution(tcsae);498//499// when(webdriverService.isElementPresent(session, identifier)).thenReturn(false);500//501// this.controlService.doControl(tcsace);502//503// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());504// Assert.assertEquals("KO", tcsace.getReturnCode());505// Assert.assertEquals("Y", tcsace.getFatal());506// }507 @Ignore508 @Test509 public void testDoControlElementPresentWhenPropertyNull() {510 String property = "null";511 String value = "id=test";512 String msg = "Object is 'null'. This is mandatory in order to perform the control verify element present";513 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();514 tcsace.setControl("verifyElementPresent");515 tcsace.setValue1(property);516 tcsace.setValue2(value);517 tcsace.setFatal("Y");518 TestCaseStepExecution tcse = new TestCaseStepExecution();519 tcse.settCExecution(tCExecution);520 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();521 tcsae.setTestCaseStepExecution(tcse);522 tcsace.setTestCaseStepActionExecution(tcsae);523 this.controlService.doControl(tcsace);524 Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());525 Assert.assertEquals("KO", tcsace.getReturnCode());526 Assert.assertEquals("Y", tcsace.getFatal());527 }528// @Ignore529// @Test530// public void testDoControlElementPresentWhenWebDriverException() {531// String property = "id=test";532// String value = "null";533// String msg = "The test case is canceled due to lost connection to Selenium Server! Detailed error : .*";534// Identifier identifier = new Identifier();535// identifier.setIdentifier("id");536// identifier.setLocator("test");537//538// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();539// tcsace.setControl("verifyElementPresent");540// tcsace.setValue1(property);541// tcsace.setValue2(value);542// tcsace.setFatal("Y");543// tCExecution.setSession(session);544// TestCaseStepExecution tcse = new TestCaseStepExecution();545// tcse.settCExecution(tCExecution);546// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();547// tcsae.setTestCaseStepExecution(tcse);548// tcsace.setTestCaseStepActionExecution(tcsae);549// 550// when(webdriverService.isElementPresent(tCExecution.getSession(), identifier)).thenThrow(new WebDriverException());551//552// this.controlService.doControl(tcsace);553//554// Assert.assertTrue( tcsace.getControlResultMessage().getDescription().matches(msg));555// Assert.assertEquals("CA", tcsace.getReturnCode());556// Assert.assertEquals("Y", tcsace.getFatal());557// }558// @Ignore559// @Test560// public void testDoControlElementNotPresentWhenSuccess() {561// String property = "id=test";562// String value = "null";563// String msg = "Element '" + property + "' is not present on the page.";564// Identifier identifier = new Identifier();565// identifier.setIdentifier("id");566// identifier.setLocator("test");567//568// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();569// tcsace.setControl("verifyElementNotPresent");570// tcsace.setValue1(property);571// tcsace.setValue2(value);572// TestCaseStepExecution tcse = new TestCaseStepExecution();573// tcse.settCExecution(tCExecution);574// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();575// tcsae.setTestCaseStepExecution(tcse);576// tcsace.setTestCaseStepActionExecution(tcsae);577//578// when(webdriverService.isElementPresent(session, identifier)).thenReturn(false);579//580// this.controlService.doControl(tcsace);581//582// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());583// Assert.assertEquals("OK", tcsace.getReturnCode());584// }585// @Ignore586// @Test587// public void testDoControlElementNotPresentWhenFail() {588// String property = "id=test";589// String value = "null";590// String msg = "Element '" + property + "' is present on the page.";591// Identifier identifier = new Identifier();592// identifier.setIdentifier("id");593// identifier.setLocator("test");594//595// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();596// tcsace.setControl("verifyElementNotPresent");597// tcsace.setValue1(property);598// tcsace.setValue2(value);599// tcsace.setFatal("Y");600// TestCaseStepExecution tcse = new TestCaseStepExecution();601// tcse.settCExecution(tCExecution);602// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();603// tcsae.setTestCaseStepExecution(tcse);604// tcsace.setTestCaseStepActionExecution(tcsae);605//606// when(webdriverService.isElementPresent(session, identifier)).thenReturn(true);607//608// this.controlService.doControl(tcsace);609//610// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());611// Assert.assertEquals("KO", tcsace.getReturnCode());612// Assert.assertEquals("Y", tcsace.getFatal());613// }614 @Ignore615 @Test616 public void testDoControlElementNotPresentWhenPropertyNull() {617 String property = "null";618 String value = "id=test";619 String msg = "Object is 'null'. This is mandatory in order to perform the control verify element not present";620 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();621 tcsace.setControl("verifyElementNotPresent");622 tcsace.setValue1(property);623 tcsace.setValue2(value);624 tcsace.setFatal("Y");625 TestCaseStepExecution tcse = new TestCaseStepExecution();626 tcse.settCExecution(tCExecution);627 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();628 tcsae.setTestCaseStepExecution(tcse);629 tcsace.setTestCaseStepActionExecution(tcsae);630 this.controlService.doControl(tcsace);631 Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());632 Assert.assertEquals("KO", tcsace.getReturnCode());633 Assert.assertEquals("Y", tcsace.getFatal());634 }635// @Ignore636// @Test637// public void testDoControlElementNotPresentWhenWebDriverException() {638// String property = "id=test";639// String value = "null";640// String msg = "The test case is canceled due to lost connection to Selenium Server! Detailed error : .*";641// Identifier identifier = new Identifier();642// identifier.setIdentifier("id");643// identifier.setLocator("test");644//645// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();646// tcsace.setControl("verifyElementNotPresent");647// tcsace.setValue1(property);648// tcsace.setValue2(value);649// tcsace.setFatal("Y");650// TestCaseStepExecution tcse = new TestCaseStepExecution();651// tcse.settCExecution(tCExecution);652// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();653// tcsae.setTestCaseStepExecution(tcse);654// tcsace.setTestCaseStepActionExecution(tcsae);655//656// when(webdriverService.isElementPresent(session, identifier)).thenThrow(new WebDriverException());657//658// this.controlService.doControl(tcsace);659//660// Assert.assertTrue(tcsace.getControlResultMessage().getDescription().matches(msg));661// Assert.assertEquals("CA", tcsace.getReturnCode());662// Assert.assertEquals("Y", tcsace.getFatal());663// }664// @Ignore665// @Test666// public void testDoControlElementNotVisibleWhenSuccess() {667// String property = "id=test";668// String value = "null";669// String msg = "Element '" + property + "' is present and not visible on the page.";670// Identifier identifier = new Identifier();671// identifier.setIdentifier("id");672// identifier.setLocator("test");673//674// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();675// tcsace.setControl("verifyElementNotVisible");676// tcsace.setValue1(property);677// tcsace.setValue2(value);678// tcsace.setFatal("Y");679// TestCaseStepExecution tcse = new TestCaseStepExecution();680// tcse.settCExecution(tCExecution);681// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();682// tcsae.setTestCaseStepExecution(tcse);683// tcsace.setTestCaseStepActionExecution(tcsae);684//685// when(webdriverService.isElementPresent(session, identifier)).thenReturn(true);686// when(webdriverService.isElementNotVisible(session, identifier)).thenReturn(true);687//688// this.controlService.doControl(tcsace);689//690// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());691// Assert.assertEquals("OK", tcsace.getReturnCode());692// }693//694// @Ignore695// @Test696// public void testDoControlElementNotVisibleWhenFail() {697// String property = "id=test";698// String value = "null";699// String msg = "Element '" + property + "' is visible on the page.";700// Identifier identifier = new Identifier();701// identifier.setIdentifier("id");702// identifier.setLocator("test");703//704// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();705// tcsace.setControl("verifyElementNotVisible");706// tcsace.setValue1(property);707// tcsace.setValue2(value);708// tcsace.setFatal("Y");709// TestCaseStepExecution tcse = new TestCaseStepExecution();710// tcse.settCExecution(tCExecution);711// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();712// tcsae.setTestCaseStepExecution(tcse);713// tcsace.setTestCaseStepActionExecution(tcsae);714//715// when(webdriverService.isElementPresent(session, identifier)).thenReturn(true);716// when(webdriverService.isElementNotVisible(session, identifier)).thenReturn(false);717//718// this.controlService.doControl(tcsace);719//720// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());721// Assert.assertEquals("KO", tcsace.getReturnCode());722// Assert.assertEquals("Y", tcsace.getFatal());723// }724 @Test725 public void testDoControlElementNotVisibleWhenPropertyNull() {726 String property = "null";727 String value = "id=test";728 String msg = "Object is 'null'. This is mandatory in order to perform the control verify element not visible";729 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();730 tcsace.setControl("verifyElementNotVisible");731 tcsace.setValue1(property);732 tcsace.setValue2(value);733 tcsace.setFatal("Y");734 TestCaseStepExecution tcse = new TestCaseStepExecution();735 tcse.settCExecution(tCExecution);736 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();737 tcsae.setTestCaseStepExecution(tcse);738 tcsace.setTestCaseStepActionExecution(tcsae);739 this.controlService.doControl(tcsace);740 Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());741 Assert.assertEquals("KO", tcsace.getReturnCode());742 Assert.assertEquals("Y", tcsace.getFatal());743 }744// @Ignore745// @Test746// public void testDoControlElementNotVisibleWhenWebDriverException() {747// String property = "id=test";748// String value = "null";749// String msg = "The test case is canceled due to lost connection to Selenium Server! Detailed error : .*";750// Identifier identifier = new Identifier();751// identifier.setIdentifier("id");752// identifier.setLocator("test");753//754// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();755// tcsace.setControl("verifyElementNotVisible");756// tcsace.setValue1(property);757// tcsace.setValue2(value);758// tcsace.setFatal("Y");759// TestCaseStepExecution tcse = new TestCaseStepExecution();760// tcse.settCExecution(tCExecution);761// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();762// tcsae.setTestCaseStepExecution(tcse);763// tcsace.setTestCaseStepActionExecution(tcsae);764//765// when(webdriverService.isElementPresent(session, identifier)).thenThrow(new WebDriverException());766//767// this.controlService.doControl(tcsace);768//769// Assert.assertTrue(tcsace.getControlResultMessage().getDescription().matches(msg));770// Assert.assertEquals("CA", tcsace.getReturnCode());771// Assert.assertEquals("Y", tcsace.getFatal());772// }773 @Test774 public void testDoControlElementInElementWhenValueIsNull() {775 String property = "id=test";776 String value = "null";777 String msg = "Element '" + value + "' is not child of element '" + property + "'.";778 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();779 tcsace.setControl("verifyElementInElement");780 tcsace.setValue1(property);781 tcsace.setValue2(value);782 tcsace.setFatal("Y");783 TestCaseStepExecution tcse = new TestCaseStepExecution();784 tcse.settCExecution(tCExecution);785 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();786 tcsae.setTestCaseStepExecution(tcse);787 tcsace.setTestCaseStepActionExecution(tcsae);788 this.controlService.doControl(tcsace);789 Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());790 Assert.assertEquals("KO", tcsace.getReturnCode());791 Assert.assertEquals("Y", tcsace.getFatal());792 }793 @Test794 public void testDoControlElementInElementWhenPropertyIsNull() {795 String property = "null";796 String value = "id=test";797 String msg = "Element '" + value + "' is not child of element '" + property + "'.";798 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();799 tcsace.setControl("verifyElementInElement");800 tcsace.setValue1(property);801 tcsace.setValue2(value);802 tcsace.setFatal("Y");803 TestCaseStepExecution tcse = new TestCaseStepExecution();804 tcse.settCExecution(tCExecution);805 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();806 tcsae.setTestCaseStepExecution(tcse);807 tcsace.setTestCaseStepActionExecution(tcsae);808 this.controlService.doControl(tcsace);809 Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());810 Assert.assertEquals("KO", tcsace.getReturnCode());811 Assert.assertEquals("Y", tcsace.getFatal());812 }813// @Ignore814// @Test815// public void testDoControlElementInElementWhenValueIsNotChildOfProperty() {816// String property = "id=parent";817// String value = "id=child";818// String msg = "Element '" + value + "' is not child of element '" + property + "'.";819// Identifier identifier = new Identifier();820// identifier.setIdentifier("id");821// identifier.setLocator("test");822// Identifier identifierValue = new Identifier();823// identifier.setIdentifier("id");824// identifier.setLocator("test2");825//826// when(webdriverService.isElementInElement(session, identifier, identifierValue)).thenReturn(Boolean.FALSE);827//828// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();829// tcsace.setControl("verifyElementInElement");830// tcsace.setValue1(property);831// tcsace.setValue2(value);832// tcsace.setFatal("Y");833// TestCaseStepExecution tcse = new TestCaseStepExecution();834// tcse.settCExecution(tCExecution);835// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();836// tcsae.setTestCaseStepExecution(tcse);837// tcsace.setTestCaseStepActionExecution(tcsae);838//839// this.controlService.doControl(tcsace);840//841// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());842// Assert.assertEquals("KO", tcsace.getReturnCode());843// Assert.assertEquals("Y", tcsace.getFatal());844// }845//846// @Ignore847// @Test848// public void testDoControlElementInElementWhenValueIsChildOfProperty() {849// String property = "id=parent";850// String value = "id=child";851// String msg = "Element '" + value + "' in child of element '" + property + "'.";852// Identifier identifier = new Identifier();853// identifier.setIdentifier("id");854// identifier.setLocator("test");855// Identifier identifierValue = new Identifier();856// identifier.setIdentifier("id");857// identifier.setLocator("test2");858//859// when(webdriverService.isElementInElement(session, identifier, identifierValue)).thenReturn(Boolean.TRUE);860//861// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();862// tcsace.setControl("verifyElementInElement");863// tcsace.setValue1(property);864// tcsace.setValue2(value);865// tcsace.setFatal("Y");866// TestCaseStepExecution tcse = new TestCaseStepExecution();867// tcse.settCExecution(tCExecution);868// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();869// tcsae.setTestCaseStepExecution(tcse);870// tcsace.setTestCaseStepActionExecution(tcsae);871//872// this.controlService.doControl(tcsace);873//874// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());875// Assert.assertEquals("OK", tcsace.getReturnCode());876// Assert.assertEquals("Y", tcsace.getFatal());877// }878 @Test879 public void testVerifyElementEqualsWithNotCompatibleApplication() {880 String xpath = "/foo/bar";881 String expectedElement = "<bar>baz</bar>";882 TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();883 tcsace.setControl("verifyElementEquals");884 tcsace.setValue1(xpath);885 tcsace.setValue2(expectedElement);886 tcsace.setFatal("Y");887 TestCaseStepExecution tcse = new TestCaseStepExecution();888 tcse.settCExecution(tCExecution);889 TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();890 tcsae.setTestCaseStepExecution(tcse);891 tcsace.setTestCaseStepActionExecution(tcsae);892 this.controlService.doControl(tcsace);893 Assert.assertEquals(MessageEventEnum.CONTROL_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION.getCode(), tcsace.getControlResultMessage().getCode());894 }895// @Test896// public void testVerifyElementEqualsWithElementPresent() {897// String xpath = "/foo/bar";898// String expectedElement = "<bar>baz</bar>";899// String xmlResponse = "<bar>bar</bar>";900// String msg = "Element in path '" + xpath + "' is equal to '" + expectedElement + "'.";901//902//// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();903//// tcsace.setControlType("verifyElementEquals");904//// tcsace.setControlProperty(xpath);905//// tcsace.setControlValue(expectedElement);906//// tcsace.setFatal("Y");907//// TestCaseStepExecution tcse = new TestCaseStepExecution();908//// tcse.settCExecution(tCExecution);909//// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();910//// tcsae.setTestCaseStepExecution(tcse);911//// tcsace.setTestCaseStepActionExecution(tcsae);912// //when(application.getType()).thenReturn("WS");913// when(xmlUnitService.isElementEquals(xmlResponse, xpath, expectedElement)).thenReturn(Boolean.TRUE);914//915// this.controlService.doControl(tcsace);916//917// Assert.assertEquals(MessageEventEnum.CONTROL_SUCCESS_ELEMENTEQUALS.getCode(), tcsace.getControlResultMessage().getCode());918// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());919// }920// @Test921// public void testVerifyElementEqualsWithElementAbsent() {922// String xpath = "/foo/bar";923// String expectedElement = "<bar>baz</bar>";924// String msg = "Element in path '" + xpath + "' is not equal to '" + expectedElement + "'.";925// 926// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();927// tcsace.setControlType("verifyElementEquals");928// tcsace.setControlProperty(xpath);929// tcsace.setControlValue(expectedElement);930// tcsace.setFatal("Y");931// TestCaseStepExecution tcse = new TestCaseStepExecution();932// tcse.settCExecution(tCExecution);933// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();934// tcsae.setTestCaseStepExecution(tcse);935// tcsace.setTestCaseStepActionExecution(tcsae);936// 937// when(application.getType()).thenReturn("WS");938// when(xmlUnitService.isElementEquals(tCExecution, xpath, expectedElement)).thenReturn(Boolean.FALSE);939//940// this.controlService.doControl(tcsace);941//942// Assert.assertEquals(MessageEventEnum.CONTROL_FAILED_ELEMENTEQUALS.getCode(), tcsace.getControlResultMessage().getCode());943// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());944// }945// 946// @Test947// public void testVerifyElementDifferentWithNotCompatibleApplication() {948// String xpath = "/foo/bar";949// String expectedElement = "<bar>baz</bar>";950//951// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();952// tcsace.setControlType("verifyElementDifferent");953// tcsace.setControlProperty(xpath);954// tcsace.setControlValue(expectedElement);955// tcsace.setFatal("Y");956// TestCaseStepExecution tcse = new TestCaseStepExecution();957// tcse.settCExecution(tCExecution);958// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();959// tcsae.setTestCaseStepExecution(tcse);960// tcsace.setTestCaseStepActionExecution(tcsae);961//962// this.controlService.doControl(tcsace);963//964// Assert.assertEquals(MessageEventEnum.CONTROL_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION.getCode(), tcsace.getControlResultMessage().getCode());965// }966// 967// @Test968// public void testVerifyElementDifferentWithElementDifferent() {969// String xpath = "/foo/bar";970// String expectedElement = "<bar>baz</bar>";971// String msg = "Element in path '" + xpath + "' is different from '" + expectedElement + "'.";972// 973// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();974// tcsace.setControlType("verifyElementDifferent");975// tcsace.setControlProperty(xpath);976// tcsace.setControlValue(expectedElement);977// tcsace.setFatal("Y");978// TestCaseStepExecution tcse = new TestCaseStepExecution();979// tcse.settCExecution(tCExecution);980// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();981// tcsae.setTestCaseStepExecution(tcse);982// tcsace.setTestCaseStepActionExecution(tcsae);983// 984// when(application.getType()).thenReturn("WS");985// when(xmlUnitService.isElementEquals(tCExecution, xpath, expectedElement)).thenReturn(Boolean.FALSE);986//987// this.controlService.doControl(tcsace);988//989// Assert.assertEquals(MessageEventEnum.CONTROL_SUCCESS_ELEMENTDIFFERENT.getCode(), tcsace.getControlResultMessage().getCode());990// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());991// }992// 993// @Test994// public void testVerifyElementDifferentWithElementEquals() {995// String xpath = "/foo/bar";996// String expectedElement = "<bar>baz</bar>";997// String msg = "Element in path '" + xpath + "' is not different from '" + expectedElement + "'.";998// 999// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();1000// tcsace.setControlType("verifyElementDifferent");1001// tcsace.setControlProperty(xpath);1002// tcsace.setControlValue(expectedElement);1003// tcsace.setFatal("Y");1004// TestCaseStepExecution tcse = new TestCaseStepExecution();1005// tcse.settCExecution(tCExecution);1006// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();1007// tcsae.setTestCaseStepExecution(tcse);1008// tcsace.setTestCaseStepActionExecution(tcsae);1009// 1010// when(application.getType()).thenReturn("WS");1011// when(xmlUnitService.isElementEquals(tCExecution, xpath, expectedElement)).thenReturn(Boolean.TRUE);1012//1013// this.controlService.doControl(tcsace);1014//1015// Assert.assertEquals(MessageEventEnum.CONTROL_FAILED_ELEMENTDIFFERENT.getCode(), tcsace.getControlResultMessage().getCode());1016// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());1017// }1018// 1019// @Test1020// public void testVerifyTextInElementWhenElementExistsAndTextEquals() {1021// String xpath = "/foo/bar";1022// String actual = "foo";1023// String expected = "foo";1024// String msg = "Element '" + xpath + "' with value '" + actual + "' is equal to '" + expected + "'.";1025//1026// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();1027// tcsace.setControlType("verifyTextInElement");1028// tcsace.setControlProperty(xpath);1029// tcsace.setControlValue(expected);1030// tcsace.setFatal("Y");1031// TestCaseStepExecution tcse = new TestCaseStepExecution();1032// tcse.settCExecution(tCExecution);1033// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();1034// tcsae.setTestCaseStepExecution(tcse);1035// tcsace.setTestCaseStepActionExecution(tcsae);1036//1037// when(application.getType()).thenReturn("WS");1038// when(tCExecution.getExecutionUUID()).thenReturn("uuid");1039// when(xmlUnitService.isElementPresent(tCExecution, xpath)).thenReturn(true);1040// when(xmlUnitService.getFromXml("uuid", null, xpath)).thenReturn(actual);1041//1042// this.controlService.doControl(tcsace);1043//1044// Assert.assertEquals(MessageEventEnum.CONTROL_SUCCESS_TEXTINELEMENT.getCode(), tcsace.getControlResultMessage().getCode());1045// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());1046// }1047// 1048// @Test1049// public void testVerifyTextInElementWhenElementExistsAndTextNotEquals() {1050// String xpath = "/foo/bar";1051// String actual = "foo";1052// String expected = "bar";1053// String msg = "Element '" + xpath + "' with value '" + actual + "' is not equal to '" + expected + "'.";1054//1055// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();1056// tcsace.setControlType("verifyTextInElement");1057// tcsace.setControlProperty(xpath);1058// tcsace.setControlValue(expected);1059// tcsace.setFatal("Y");1060// TestCaseStepExecution tcse = new TestCaseStepExecution();1061// tcse.settCExecution(tCExecution);1062// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();1063// tcsae.setTestCaseStepExecution(tcse);1064// tcsace.setTestCaseStepActionExecution(tcsae);1065//1066// when(application.getType()).thenReturn("WS");1067// when(tCExecution.getExecutionUUID()).thenReturn("uuid");1068// when(xmlUnitService.isElementPresent(tCExecution, xpath)).thenReturn(true);1069// when(xmlUnitService.getFromXml("uuid", null, xpath)).thenReturn(actual);1070//1071// this.controlService.doControl(tcsace);1072//1073// Assert.assertEquals(MessageEventEnum.CONTROL_FAILED_TEXTINELEMENT.getCode(), tcsace.getControlResultMessage().getCode());1074// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());1075// }1076// 1077// @Test1078// public void testVerifyTextInElementWhenElementExistsAndTextIsNull() {1079// String xpath = "/foo/bar";1080// String actual = null;1081// String expected = "bar";1082// String msg = "Found Element '" + xpath + "' but can not find text or value.";1083//1084// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();1085// tcsace.setControlType("verifyTextInElement");1086// tcsace.setControlProperty(xpath);1087// tcsace.setControlValue(expected);1088// tcsace.setFatal("Y");1089// TestCaseStepExecution tcse = new TestCaseStepExecution();1090// tcse.settCExecution(tCExecution);1091// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();1092// tcsae.setTestCaseStepExecution(tcse);1093// tcsace.setTestCaseStepActionExecution(tcsae);1094//1095// when(application.getType()).thenReturn("WS");1096// when(tCExecution.getExecutionUUID()).thenReturn("uuid");1097// when(xmlUnitService.isElementPresent(tCExecution, xpath)).thenReturn(true);1098// when(xmlUnitService.getFromXml("uuid", null, xpath)).thenReturn(actual);1099//1100// this.controlService.doControl(tcsace);1101//1102// Assert.assertEquals(MessageEventEnum.CONTROL_FAILED_TEXTINELEMENT_NULL.getCode(), tcsace.getControlResultMessage().getCode());1103// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());1104// }1105// 1106// @Test1107// public void testVerifyTextInElementWhenElementNotExists() {1108// String xpath = "/foo/bar";1109// String expected = "bar";1110// String msg = "Failed to verifyTextInElement because could not find element '" + xpath + "'";1111//1112// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();1113// tcsace.setControlType("verifyTextInElement");1114// tcsace.setControlProperty(xpath);1115// tcsace.setControlValue(expected);1116// tcsace.setFatal("Y");1117// TestCaseStepExecution tcse = new TestCaseStepExecution();1118// tcse.settCExecution(tCExecution);1119// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();1120// tcsae.setTestCaseStepExecution(tcse);1121// tcsace.setTestCaseStepActionExecution(tcsae);1122//1123// when(application.getType()).thenReturn("WS");1124// when(tCExecution.getExecutionUUID()).thenReturn("uuid");1125// when(xmlUnitService.isElementPresent(tCExecution, xpath)).thenReturn(false);1126//1127// this.controlService.doControl(tcsace);1128//1129// Assert.assertEquals(MessageEventEnum.CONTROL_FAILED_TEXTINELEMENT_NO_SUCH_ELEMENT.getCode(), tcsace.getControlResultMessage().getCode());1130// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());1131// }1132// 1133// public void testVerifyTextInElementWithNotSupportedApplication() {1134// String xpath = "/foo/bar";1135// String actual = "foo";1136// String expected = "bar";1137// String msg = "Not executed because Control 'verifyTextInElement' is not supported for application type 'UNKNOWN'.";1138//1139// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();1140// tcsace.setControlType("verifyTextInElement");1141// tcsace.setControlProperty(xpath);1142// tcsace.setControlValue(expected);1143// tcsace.setFatal("Y");1144// TestCaseStepExecution tcse = new TestCaseStepExecution();1145// tcse.settCExecution(tCExecution);1146// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();1147// tcsae.setTestCaseStepExecution(tcse);1148// tcsace.setTestCaseStepActionExecution(tcsae);1149//1150// when(application.getType()).thenReturn("UNKNOWN");1151// when(tCExecution.getExecutionUUID()).thenReturn("uuid");1152// when(xmlUnitService.isElementPresent(tCExecution, xpath)).thenReturn(true);1153// when(xmlUnitService.getFromXml("uuid", null, xpath)).thenReturn(actual);1154//1155// this.controlService.doControl(tcsace);1156//1157// Assert.assertEquals(MessageEventEnum.CONTROL_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION.getCode(), tcsace.getControlResultMessage().getCode());1158// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());1159// }1160// 1161// @Test1162// public void testVerifyTextNotInElementWhenElementExistsAndTextDifferent() {1163// String xpath = "/foo/bar";1164// String actual = "foo";1165// String expected = "bar";1166// String msg = "Element '" + xpath + "' with value '" + actual + "' is different than '" + expected + "'.";1167//1168// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();1169// tcsace.setControlType("verifyTextNotInElement");1170// tcsace.setControlProperty(xpath);1171// tcsace.setControlValue(expected);1172// tcsace.setFatal("Y");1173// TestCaseStepExecution tcse = new TestCaseStepExecution();1174// tcse.settCExecution(tCExecution);1175// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();1176// tcsae.setTestCaseStepExecution(tcse);1177// tcsace.setTestCaseStepActionExecution(tcsae);1178//1179// when(application.getType()).thenReturn("WS");1180// when(tCExecution.getExecutionUUID()).thenReturn("uuid");1181// when(xmlUnitService.isElementPresent(tCExecution, xpath)).thenReturn(true);1182// when(xmlUnitService.getFromXml("uuid", null, xpath)).thenReturn(actual);1183//1184// this.controlService.doControl(tcsace);1185//1186// Assert.assertEquals(MessageEventEnum.CONTROL_SUCCESS_TEXTNOTINELEMENT.getCode(), tcsace.getControlResultMessage().getCode());1187// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());1188// }1189// 1190// @Test1191// public void testVerifyTextNotInElementWhenElementExistsAndTextNotDifferent() {1192// String xpath = "/foo/bar";1193// String actual = "foo";1194// String expected = "foo";1195// String msg = "Element '" + xpath + "' with value '" + actual + "' is not different than '" + expected + "'.";1196//1197// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();1198// tcsace.setControlType("verifyTextNotInElement");1199// tcsace.setControlProperty(xpath);1200// tcsace.setControlValue(expected);1201// tcsace.setFatal("Y");1202// TestCaseStepExecution tcse = new TestCaseStepExecution();1203// tcse.settCExecution(tCExecution);1204// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();1205// tcsae.setTestCaseStepExecution(tcse);1206// tcsace.setTestCaseStepActionExecution(tcsae);1207//1208// when(application.getType()).thenReturn("WS");1209// when(tCExecution.getExecutionUUID()).thenReturn("uuid");1210// when(xmlUnitService.isElementPresent(tCExecution, xpath)).thenReturn(true);1211// when(xmlUnitService.getFromXml("uuid", null, xpath)).thenReturn(actual);1212//1213// this.controlService.doControl(tcsace);1214//1215// Assert.assertEquals(MessageEventEnum.CONTROL_FAILED_TEXTNOTINELEMENT.getCode(), tcsace.getControlResultMessage().getCode());1216// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());1217// }1218// 1219// @Test1220// public void testVerifyTextNotInElementWhenElementExistsAndTextIsNull() {1221// String xpath = "/foo/bar";1222// String actual = null;1223// String expected = "bar";1224// String msg = "Found Element '" + xpath + "' but can not find text or value.";1225//1226// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();1227// tcsace.setControlType("verifyTextNotInElement");1228// tcsace.setControlProperty(xpath);1229// tcsace.setControlValue(expected);1230// tcsace.setFatal("Y");1231// TestCaseStepExecution tcse = new TestCaseStepExecution();1232// tcse.settCExecution(tCExecution);1233// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();1234// tcsae.setTestCaseStepExecution(tcse);1235// tcsace.setTestCaseStepActionExecution(tcsae);1236//1237// when(application.getType()).thenReturn("WS");1238// when(tCExecution.getExecutionUUID()).thenReturn("uuid");1239// when(xmlUnitService.isElementPresent(tCExecution, xpath)).thenReturn(true);1240// when(xmlUnitService.getFromXml("uuid", null, xpath)).thenReturn(actual);1241//1242// this.controlService.doControl(tcsace);1243//1244// Assert.assertEquals(MessageEventEnum.CONTROL_FAILED_TEXTNOTINELEMENT_NULL.getCode(), tcsace.getControlResultMessage().getCode());1245// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());1246// }1247// 1248// @Test1249// public void testVerifyTextNotInElementWhenElementNotExists() {1250// String xpath = "/foo/bar";1251// String expected = "bar";1252// String msg = "Failed to verifyTextNotInElement because could not find element '" + xpath + "'";1253//1254// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();1255// tcsace.setControlType("verifyTextNotInElement");1256// tcsace.setControlProperty(xpath);1257// tcsace.setControlValue(expected);1258// tcsace.setFatal("Y");1259// TestCaseStepExecution tcse = new TestCaseStepExecution();1260// tcse.settCExecution(tCExecution);1261// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();1262// tcsae.setTestCaseStepExecution(tcse);1263// tcsace.setTestCaseStepActionExecution(tcsae);1264//1265// when(application.getType()).thenReturn("WS");1266// when(tCExecution.getExecutionUUID()).thenReturn("uuid");1267// when(xmlUnitService.isElementPresent(tCExecution, xpath)).thenReturn(false);1268//1269// this.controlService.doControl(tcsace);1270//1271// Assert.assertEquals(MessageEventEnum.CONTROL_FAILED_TEXTNOTINELEMENT_NO_SUCH_ELEMENT.getCode(), tcsace.getControlResultMessage().getCode());1272// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());1273// }1274// 1275// public void testVerifyTextNotInElementWithNotSupportedApplication() {1276// String xpath = "/foo/bar";1277// String actual = "foo";1278// String expected = "bar";1279// String msg = "Not executed because Control 'verifyTextNotInElement' is not supported for application type 'UNKNOWN'.";1280//1281// TestCaseStepActionControlExecution tcsace = new TestCaseStepActionControlExecution();1282// tcsace.setControlType("verifyTextNotInElement");1283// tcsace.setControlProperty(xpath);1284// tcsace.setControlValue(expected);1285// tcsace.setFatal("Y");1286// TestCaseStepExecution tcse = new TestCaseStepExecution();1287// tcse.settCExecution(tCExecution);1288// TestCaseStepActionExecution tcsae = new TestCaseStepActionExecution();1289// tcsae.setTestCaseStepExecution(tcse);1290// tcsace.setTestCaseStepActionExecution(tcsae);1291//1292// when(application.getType()).thenReturn("UNKNOWN");1293// when(tCExecution.getExecutionUUID()).thenReturn("uuid");1294// when(xmlUnitService.isElementPresent(tCExecution, xpath)).thenReturn(true);1295// when(xmlUnitService.getFromXml("uuid", null, xpath)).thenReturn(actual);1296//1297// this.controlService.doControl(tcsace);1298//1299// Assert.assertEquals(MessageEventEnum.CONTROL_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION.getCode(), tcsace.getControlResultMessage().getCode());1300// Assert.assertEquals(msg, tcsace.getControlResultMessage().getDescription());1301// }1302// 1303}...

Full Screen

Full Screen

doControl

Using AI Code Generation

copy

Full Screen

1package com.cerberus.engine.gwt.impl;2import java.io.IOException;3import java.io.PrintWriter;4import java.util.ArrayList;5import java.util.List;6import javax.servlet.ServletException;7import javax.servlet.http.HttpServlet;8import javax.servlet.http.HttpServletRequest;9import javax.servlet.http.HttpServletResponse;10import org.cerberus.engine.gwt.impl.ControlService;11import org.cerberus.engine.gwt.impl.ControlServiceAsync;12import com.google.gwt.user.client.rpc.AsyncCallback;13import com.google.gwt.user.client.rpc.ServiceDefTarget;14public class 3 extends HttpServlet {15 private static final long serialVersionUID = 1L;16 public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {17 resp.setContentType("text/html");18 PrintWriter out = resp.getWriter();19 out.println("<html>");20 out.println("<head><title>Hello World</title></head>");21 out.println("<body>");22 ControlServiceAsync controlService = (ControlServiceAsync) GWT.create(ControlService.class);23 ServiceDefTarget endpoint = (ServiceDefTarget) controlService;24 String moduleRelativeURL = GWT.getModuleBaseURL() + "ControlService";25 endpoint.setServiceEntryPoint(moduleRelativeURL);26 controlService.doControl(new AsyncCallback<String>() {27 public void onFailure(Throwable caught) {28 out.println("Error");29 }30 public void onSuccess(String result) {31 out.println(result);32 }33 });34 out.println("</body></html>");35 }36}37package org.cerberus.engine.gwt.impl;38import com.google.gwt.user.server.rpc.RemoteServiceServlet;39public class ControlService extends RemoteServiceServlet implements ControlServiceAsync {40 private static final long serialVersionUID = 1L;41 public String doControl() {42 return "Hello World";43 }44}

Full Screen

Full Screen

doControl

Using AI Code Generation

copy

Full Screen

1import org.cerberus.engine.gwt.impl.ControlService;2import org.cerberus.engine.gwt.impl.ControlServiceServiceLocator;3public class 3 {4 public static void main(String[] args) throws Exception {5 ControlServiceServiceLocator service = new ControlServiceServiceLocator();6 ControlService port = service.getControlService();7 port.doControl("12345", "START");8 }9}10import org.cerberus.engine.gwt.impl.ControlService;11import org.cerberus.engine.gwt.impl.ControlServiceServiceLocator;12public class 4 {13 public static void main(String[] args) throws Exception {14 ControlServiceServiceLocator service = new ControlServiceServiceLocator();15 ControlService port = service.getControlService();16 port.doControl("12345", "STOP");17 }18}19import org.cerberus.engine.gwt.impl.ControlService;20import org.cerberus.engine.gwt.impl.ControlServiceServiceLocator;21public class 5 {22 public static void main(String[] args) throws Exception {23 ControlServiceServiceLocator service = new ControlServiceServiceLocator();24 ControlService port = service.getControlService();25 port.doControl("12345", "PAUSE");26 }27}28import org.cerberus.engine.gwt.impl.ControlService;29import org.cerberus.engine.gwt.impl.ControlServiceServiceLocator;30public class 6 {31 public static void main(String[] args) throws Exception {32 ControlServiceServiceLocator service = new ControlServiceServiceLocator();33 ControlService port = service.getControlService();34 port.doControl("12345", "RESUME");35 }36}37import org.cerberus.engine.gwt.impl.ControlService;38import org.cerberus.engine.gwt.impl.ControlService

Full Screen

Full Screen

doControl

Using AI Code Generation

copy

Full Screen

1package com.cerberus.client;2import java.util.HashMap;3import java.util.Map;4import com.google.gwt.core.client.EntryPoint;5import com.google.gwt.core.client.GWT;6import com.google.gwt.user.client.ui.Button;7import com.google.gwt.user.client.ui.ClickListener;8import com.google.gwt.user.client.ui.RootPanel;9import com.google.gwt.user.client.ui.Widget;10import com.google.gwt.user.client.ui.HTML;11public class Cerberus implements EntryPoint {12private final ControlServiceAsync controlService = GWT.create(ControlService.class);13public void onModuleLoad() {14final Button button = new Button("Click me");15final HTML html = new HTML();16button.addClickListener(new ClickListener() {17public void onClick(Widget sender) {18Map<String, Object> map = new HashMap<String, Object>();19map.put("name", "Cerberus");20public void onSuccess(Object result) {21html.setHTML((String)result);22}23public void onFailure(Throwable caught) {24Window.alert(caught.toString());25}26});27}28});29RootPanel.get("gwtContainer").add(button);30RootPanel.get("gwtContainer").add(html);31}32}33package com.cerberus.client;34import java.util.HashMap;35import java.util.Map;36import com.google.gwt.core.client.EntryPoint;37import com.google.gwt.core.client.GWT;38import com.google.gwt.user.client.ui.Button;39import com.google.gwt.user.client.ui.ClickListener;40import com.google.gwt.user.client.ui.RootPanel;41import com.google.gwt.user.client.ui.Widget;42import com.google.gwt.user.client.ui.HTML;43public class Cerberus implements EntryPoint {44private final ControlServiceAsync controlService = GWT.create(ControlService.class);45public void onModuleLoad() {46final Button button = new Button("Click me");47final HTML html = new HTML();48button.addClickListener(new ClickListener() {

Full Screen

Full Screen

doControl

Using AI Code Generation

copy

Full Screen

1public class 3 {2public static void main(String[] args) {3org.cerberus.engine.gwt.impl.ControlService controlService = new org.cerberus.engine.gwt.impl.ControlService();4String value = controlService.doControl("controlName");5System.out.println("Value of the control is : "+value);6}7}8public class 4 {9public static void main(String[] args) {10org.cerberus.engine.gwt.impl.ControlService controlService = new org.cerberus.engine.gwt.impl.ControlService();11String value = controlService.doControl("controlName");12System.out.println("Value of the control is : "+value);13}14}15public class 5 {16public static void main(String[] args) {

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful