Best Cerberus-source code snippet using org.cerberus.crud.entity.TestCaseExecution.getExecutor
Source:ExecutionStartService.java
...387 if (StringUtil.isNullOrEmpty(tCExecution.getRobotExecutor())) {388 LOG.debug("Getting the best Executor on Robot : " + tCExecution.getRobot());389 robExeObj = robotExecutorService.readBestByKey(tCExecution.getRobot());390 if (robExeObj != null) {391 tCExecution.setRobotExecutor(robExeObj.getExecutor());392 tCExecution.setRobotExecutorObj(robExeObj);393 robotExecutorService.updateLastExe(robExeObj.getRobot(), robExeObj.getExecutor());394 } else {395 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_ROBOTBESTEXECUTORNOTEXIST)396 .resolveDescription("ROBOT", tCExecution.getRobot())397 .resolveDescription("EXECUTOR", tCExecution.getRobotExecutor()));398 }399 LOG.debug(" Executor retreived : " + robExeObj.getExecutor());400 } else {401 LOG.debug(" Getting Requested Robot / Executor : " + tCExecution.getRobot() + " / " + tCExecution.getRobotExecutor());402 robExeObj = robotExecutorService.convert(robotExecutorService.readByKey(tCExecution.getRobot(), tCExecution.getRobotExecutor()));403 tCExecution.setRobotExecutorObj(robExeObj);404 if (robExeObj == null) {405 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_ROBOTEXECUTORNOTEXIST)406 .resolveDescription("ROBOT", tCExecution.getRobot())407 .resolveDescription("EXECUTOR", tCExecution.getRobotExecutor()));408 } else {409 // We cannot execute a testcase on a desactivated Robot.410 if ("N".equalsIgnoreCase(robExeObj.getActive())) {411 LOG.debug("Robot Executor " + tCExecution.getRobot() + " / " + tCExecution.getRobotExecutor() + " is not active.");412 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_ROBOTEXECUTORNOTACTIVE)413 .resolveDescription("ROBOT", tCExecution.getRobot())414 .resolveDescription("EXECUTOR", tCExecution.getRobotExecutor()));415 }416 }417 }418 robotHost = ParameterParserUtil.parseStringParam(robExeObj.getHost(), tCExecution.getRobotHost());419 robotPort = ParameterParserUtil.parseStringParam(String.valueOf(robExeObj.getPort()), tCExecution.getRobotPort());420 tCExecution.setRobotHost(robotHost);421 tCExecution.setRobotPort(robotPort);422 tCExecution.setSeleniumIP(robotHost);423 tCExecution.setSeleniumPort(robotPort);424 tCExecution.setSeleniumIPUser(robExeObj.getHostUser());425 tCExecution.setSeleniumIPPassword(robExeObj.getHostPassword());426 } else {427 tCExecution.setRobotDecli(browser);428 }429 /**430 * If Timeout is defined at the execution level, set action wait default431 * to this value, else Get the cerberus_action_wait_default parameter.432 * This parameter will be used by tha wait action if no timeout/event is433 * defined.434 */435 try {436 if (!tCExecution.getTimeout().isEmpty()) {437 tCExecution.setCerberus_action_wait_default(Integer.valueOf(tCExecution.getTimeout()));438 } else {439 tCExecution.setCerberus_action_wait_default(parameterService.getParameterIntegerByKey("cerberus_action_wait_default", tCExecution.getApplicationObj().getSystem(), 90000));440 }441 } catch (NumberFormatException ex) {442 LOG.warn("Parameter cerberus_action_wait_default must be an integer, default value set to 90000 milliseconds. " + ex.toString());443 tCExecution.setCerberus_action_wait_default(90000);444 }445 /**446 * Check if test can be executed TODO : Replace Message with try/catch447 * cerberus exception448 */449 tCExecution.setResultMessage(new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_VALIDATIONSTARTING));450 LOG.debug("Performing the Checks before starting the execution");451 MessageGeneral canExecuteTestCase = this.executionCheckService.checkTestCaseExecution(tCExecution);452 tCExecution.setResultMessage(canExecuteTestCase);453 /**454 * We stop if the result is not OK455 */456 if (!(tCExecution.getResultMessage().equals(new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_CHECKINGPARAMETERS)))) {457 return tCExecution;458 }459 LOG.debug("Checks performed -- > OK to continue.");460 /**461 * Changing Automatic execution flag depending on test case information.462 */463 if (tCExecution.getManualExecution().equals(TestCaseExecution.MANUAL_A)) {464 if (tCExecution.getTestCaseObj().getGroup().equals(TestCase.GROUP_AUTOMATED)465 || tCExecution.getTestCaseObj().getGroup().equals(TestCase.GROUP_PRIVATE)) {466 tCExecution.setManualExecution(TestCaseExecution.MANUAL_N);467 } else {468 tCExecution.setManualExecution(TestCaseExecution.MANUAL_Y);469 }470 }471 /**472 * For GUI application, check if Browser is supported.473 */474 if (!tCExecution.getManualExecution().equals("Y") && tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {475 try {476 myInvariant = invariantService.convert(invariantService.readByKey("BROWSER", tCExecution.getBrowser()));477 } catch (CerberusException ex) {478 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_BROWSER_NOT_SUPPORTED);479 mes.setDescription(mes.getDescription().replace("%BROWSER%", tCExecution.getBrowser()));480 LOG.debug(mes.getDescription());481 throw new CerberusException(mes);482 }483 }484 /**485 * Register RunID inside database.486 */487 tCExecution.setResultMessage(new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_CREATINGRUNID));488 LOG.debug("Registering Execution ID on database");489 long runID = 0;490 try {491 runID = this.testCaseExecutionService.registerRunID(tCExecution);492 if (runID != 0) {493 tCExecution.setId(runID);494 executionUUIDObject.setExecutionUUID(tCExecution.getExecutionUUID(), tCExecution);495 // Update Queue Execution here if QueueID =! 0.496 if (tCExecution.getQueueID() != 0) {497 inQueueService.updateToExecuting(tCExecution.getQueueID(), "", runID);498 }499 } else {500 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_COULDNOTCREATE_RUNID);501 tCExecution.setResultMessage(mes);502 LOG.fatal("Could not create RunID, or cannot retreive the generated Key");503 throw new CerberusException(mes);504 }505 } catch (CerberusException ex) {506 tCExecution.setResultMessage(new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_COULDNOTCREATE_RUNID));507 LOG.warn(ex.getMessageError().getDescription(), ex);508 throw new CerberusException(ex.getMessageError(), ex);509 }510 LOG.debug("Execution ID registered on database : " + tCExecution.getId());511 /**512 * Stop the browser if executionID is equal to zero (to prevent database513 * instabilities)514 */515 if (tCExecution.getManualExecution().equals(TestCaseExecution.MANUAL_Y)) {516 // Set execution executor from testcase executor (only for manual execution).517 tCExecution.setExecutor(tCExecution.getTestCaseObj().getExecutor());518// try {519// if (tCExecution.getId() == 0) {520// LOG.debug("Starting to Stop the Selenium Server.");521// this.serverService.stopServer(tCExecution);522// LOG.debug("Selenium Server stopped.");523// this.serverService.stopRemoteProxy(tCExecution);524//525// }526// } catch (Exception ex) {527// LOG.warn(ex.toString(), ex);528// }529 }530 /**531 * Stop the Cerberus Executor Proxy...
getExecutor
Using AI Code Generation
1String executor = testCaseExecution.getExecutor();2String envData = testCaseExecution.getEnvironmentData();3String country = testCaseExecution.getCountry();4String browser = testCaseExecution.getBrowser();5String browserVersion = testCaseExecution.getBrowserVersion();6String platform = testCaseExecution.getPlatform();7String build = testCaseExecution.getBuild();8String revision = testCaseExecution.getRevision();9String revision = testCaseExecution.getRevision();10String revision = testCaseExecution.getRevision();11String application = testCaseExecution.getApplication();12String application = testCaseExecution.getApplication();
getExecutor
Using AI Code Generation
1testcase.getExecutor()2testcase.getTest()3testcase.getTestCase()4testcase.getCountry()5testcase.getEnvironment()6testcase.getBrowser()7testcase.getBrowserFullVersion()
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!