How to use getConditionOperator method of org.cerberus.crud.entity.TestCaseStepActionExecution class

Best Cerberus-source code snippet using org.cerberus.crud.entity.TestCaseStepActionExecution.getConditionOperator

Source:ExecutionRunService.java Github

copy

Full Screen

...497 LOG.warn(cex);498 }499 }500 if (!conditionDecodeError) {501 conditionAnswerTc = this.conditionService.evaluateCondition(tCExecution.getConditionOperator(), tCExecution.getConditionVal1(), tCExecution.getConditionVal2(), tCExecution.getConditionVal3(), tCExecution);502 boolean execute_TestCase = (boolean) conditionAnswerTc.getItem();503 if (execute_TestCase || tCExecution.getManualExecution().equals("Y")) {504 boolean doStepStopExecution = false;505 for (TestCaseStep testCaseStep : mainExecutionTestCaseStepList) {506 // exeMod management : We trigger Forced Step no matter if previous step execution asked to stop.507 if ((!doStepStopExecution) || (testCaseStep.getForceExe().equalsIgnoreCase("Y"))) {508 // init the index of the step in case we loop.509 int step_index = 1;510 boolean execute_Next_Step = false;511 TestCaseStepExecution testCaseStepExecution;512 int maxloop = parameterService.getParameterIntegerByKey("cerberus_loopstep_max", tCExecution.getApplicationObj().getSystem(), 20);513 // Step Loop management.514 do {515 /**516 * Start Execution of TestCaseStep517 */518 LOG.debug(logPrefix + "Start execution of testcasestep");519 long startStep = new Date().getTime();520 /**521 * Create and Register TestCaseStepExecution522 */523 MessageEvent stepMess = new MessageEvent(MessageEventEnum.STEP_PENDING)524 .resolveDescription("STEP", String.valueOf(testCaseStep.getSort()))525 .resolveDescription("STEPINDEX", String.valueOf(step_index));526 testCaseStepExecution = factoryTestCaseStepExecution.create(527 runID, testCaseStep.getTest(), testCaseStep.getTestCase(),528 testCaseStep.getStep(), step_index, testCaseStep.getSort(), testCaseStep.getLoop(), testCaseStep.getConditionOperator(), testCaseStep.getConditionVal1(), testCaseStep.getConditionVal2(), testCaseStep.getConditionVal3(), testCaseStep.getConditionVal1(), testCaseStep.getConditionVal2(), testCaseStep.getConditionVal3(), null,529 startStep, startStep, startStep, startStep, new BigDecimal("0"), null, stepMess, testCaseStep, tCExecution,530 testCaseStep.getUseStep(), testCaseStep.getUseStepTest(), testCaseStep.getUseStepTestCase(), testCaseStep.getUseStepStep(), testCaseStep.getDescription());531 testCaseStepExecution.setLoop(testCaseStep.getLoop());532 testCaseStepExecutionService.insertTestCaseStepExecution(testCaseStepExecution);533 testCaseStepExecution.setExecutionResultMessage(new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_TESTSTARTED));534 /**535 * We populate the TestCaseStep inside the536 * execution List537 */538 tCExecution.addTestCaseStepExecutionList(testCaseStepExecution);539 // determine if step is executed (execute_Step) and if we trigger a new step execution after (execute_Next_Step)540 boolean execute_Step = true;541 boolean descriptionOrConditionStepDecodeError = false;542 boolean conditionStepError = false;543 AnswerItem<Boolean> conditionAnswer = new AnswerItem<>(new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_UNKNOWNCONDITION));544 if (testCaseStepExecution.getLoop().equals(TestCaseStep.LOOP_ONCEIFCONDITIONFALSE)545 || testCaseStepExecution.getLoop().equals(TestCaseStep.LOOP_ONCEIFCONDITIONTRUE)546 || testCaseStepExecution.getLoop().equals(TestCaseStep.LOOP_WHILECONDITIONFALSEDO)547 || testCaseStepExecution.getLoop().equals(TestCaseStep.LOOP_WHILECONDITIONTRUEDO)548 || testCaseStepExecution.getLoop().equals("")549 || step_index > 1) {550 // Decode Conditionvalue1 and Conditionvalue2 and Evaluate the condition at the Step level.551 try {552 answerDecode = variableService.decodeStringCompletly(testCaseStepExecution.getConditionVal1(), tCExecution, null, false);553 testCaseStepExecution.setConditionVal1((String) answerDecode.getItem());554 if (!(answerDecode.isCodeStringEquals("OK"))) {555 testCaseStepExecution.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));556 testCaseStepExecution.setStepResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Step Condition Value1"));557 testCaseStepExecution.setReturnMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Step Condition Value1").getDescription());558 testCaseStepExecution.setReturnCode(answerDecode.getResultMessage().getCodeString());559 testCaseStepExecution.setStopExecution(answerDecode.getResultMessage().isStopTest());560 testCaseStepExecution.setEnd(new Date().getTime());561 LOG.debug(logPrefix + "Step interupted due to decode 'Step Condition Value1' Error.");562 descriptionOrConditionStepDecodeError = true;563 }564 } catch (CerberusEventException cex) {565 LOG.warn(cex);566 }567 if (!descriptionOrConditionStepDecodeError) {568 try {569 answerDecode = variableService.decodeStringCompletly(testCaseStepExecution.getConditionVal2(), tCExecution, null, false);570 testCaseStepExecution.setConditionVal2((String) answerDecode.getItem());571 if (!(answerDecode.isCodeStringEquals("OK"))) {572 testCaseStepExecution.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));573 testCaseStepExecution.setStepResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Step Condition Value2"));574 testCaseStepExecution.setReturnMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Step Condition Value2").getDescription());575 testCaseStepExecution.setReturnCode(answerDecode.getResultMessage().getCodeString());576 testCaseStepExecution.setStopExecution(answerDecode.getResultMessage().isStopTest());577 testCaseStepExecution.setEnd(new Date().getTime());578 LOG.debug(logPrefix + "Step interupted due to decode 'Step Condition Value2' Error.");579 descriptionOrConditionStepDecodeError = true;580 }581 } catch (CerberusEventException cex) {582 LOG.warn(cex);583 }584 }585 if (!descriptionOrConditionStepDecodeError) {586 try {587 answerDecode = variableService.decodeStringCompletly(testCaseStepExecution.getConditionVal3(), tCExecution, null, false);588 testCaseStepExecution.setConditionVal3((String) answerDecode.getItem());589 if (!(answerDecode.isCodeStringEquals("OK"))) {590 testCaseStepExecution.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));591 testCaseStepExecution.setStepResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Step Condition Value3"));592 testCaseStepExecution.setReturnMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Step Condition Value3").getDescription());593 testCaseStepExecution.setReturnCode(answerDecode.getResultMessage().getCodeString());594 testCaseStepExecution.setStopExecution(answerDecode.getResultMessage().isStopTest());595 testCaseStepExecution.setEnd(new Date().getTime());596 LOG.debug(logPrefix + "Step interupted due to decode 'Step Condition Value3' Error.");597 descriptionOrConditionStepDecodeError = true;598 }599 } catch (CerberusEventException cex) {600 LOG.warn(cex);601 }602 }603 if (!descriptionOrConditionStepDecodeError) {604 try {605 answerDecode = variableService.decodeStringCompletly(testCaseStepExecution.getDescription(), tCExecution, null, false);606 testCaseStepExecution.setDescription((String) answerDecode.getItem());607 if (!(answerDecode.isCodeStringEquals("OK"))) {608 testCaseStepExecution.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));609 testCaseStepExecution.setStepResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Step Description"));610 testCaseStepExecution.setReturnMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Step Description").getDescription());611 testCaseStepExecution.setReturnCode(answerDecode.getResultMessage().getCodeString());612 testCaseStepExecution.setStopExecution(answerDecode.getResultMessage().isStopTest());613 testCaseStepExecution.setEnd(new Date().getTime());614 LOG.debug(logPrefix + "Step interupted due to decode 'Step Description' Error.");615 descriptionOrConditionStepDecodeError = true;616 }617 } catch (CerberusEventException cex) {618 LOG.warn(cex);619 }620 }621 if (!(descriptionOrConditionStepDecodeError)) {622 conditionAnswer = this.conditionService.evaluateCondition(testCaseStepExecution.getConditionOperator(), testCaseStepExecution.getConditionVal1(), testCaseStepExecution.getConditionVal2(), testCaseStepExecution.getConditionVal3(), tCExecution);623 execute_Step = (boolean) conditionAnswer.getItem();624 if (conditionAnswer.getResultMessage().getMessage().getCodeString().equals("PE")) {625 // There were no error when performing the condition evaluation.626 switch (testCaseStepExecution.getLoop()) {627 case TestCaseStep.LOOP_ONCEIFCONDITIONFALSE:628 execute_Step = !execute_Step;629 execute_Next_Step = false;630 break;631 case TestCaseStep.LOOP_ONCEIFCONDITIONTRUE:632 case "":633 execute_Next_Step = false;634 break;635 case TestCaseStep.LOOP_WHILECONDITIONFALSEDO:636 case TestCaseStep.LOOP_DOWHILECONDITIONFALSE:637 execute_Step = !execute_Step;638 execute_Next_Step = execute_Step;639 break;640 case TestCaseStep.LOOP_WHILECONDITIONTRUEDO:641 case TestCaseStep.LOOP_DOWHILECONDITIONTRUE:642 execute_Next_Step = execute_Step;643 break;644 default:645 execute_Next_Step = false;646 }647 } else {648 // Error when performing the condition evaluation. We force no execution (false)649 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_CONDITION);650 mes.setDescription(mes.getDescription()651 .replace("%AREA%", "step ")652 .replace("%COND%", testCaseStepExecution.getConditionOperator())653 .replace("%MES%", conditionAnswer.getResultMessage().getDescription()));654 tCExecution.setResultMessage(mes);655 testCaseStepExecution.setExecutionResultMessage(mes);656 testCaseStepExecution.setStepResultMessage(new MessageEvent(MessageEventEnum.CONDITION_TESTCASESTEP_FAILED)657 .resolveDescription("AREA", "")658 .resolveDescription("COND", testCaseStepExecution.getConditionOperator())659 .resolveDescription("MESSAGE", conditionAnswer.getResultMessage().getDescription())660 );661 testCaseStepExecution.setEnd(new Date().getTime());662 LOG.debug(logPrefix + "Step interupted due to condition error.");663 conditionStepError = true;664 execute_Next_Step = false;665 execute_Step = false;666 }667 } else {668 // If anything wrong with the decode --> we stop here with decode message in the action result.669 tCExecution.setResultMessage(new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_DECODE)670 .resolveDescription("AREA", "Step")671 .resolveDescription("MES", answerDecode.getMessageDescription()));672 tCExecution.setEnd(new Date().getTime());673 LOG.debug(logPrefix + "TestCase interupted due to decode Error.");674 // There was an error on decode so we stop everything.675 if (tCExecution.getManualExecution().equals("Y")) {676 execute_Next_Step = true;677 execute_Step = true;678 } else {679 execute_Next_Step = false;680 execute_Step = false;681 }682 }683 } else if (testCaseStepExecution.getLoop().equals(TestCaseStep.LOOP_DOWHILECONDITIONFALSE)684 || testCaseStepExecution.getLoop().equals(TestCaseStep.LOOP_DOWHILECONDITIONTRUE)) {685 // First Step execution for LOOP_DOWHILECONDITIONTRUE and LOOP_DOWHILECONDITIONFALSE --> We force the step execution and activate the next step execution.686 execute_Step = true;687 execute_Next_Step = true;688 } else {689 // First Step execution for Unknown Loop --> We force the step execution only once (default behaviour).690 execute_Step = true;691 execute_Next_Step = false;692 conditionAnswer.setResultMessage(new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_UNKNOWNCONDITION));693 }694 /**695 * Execute Step696 */697 LOG.debug(logPrefix + "Executing step : " + testCaseStepExecution.getTest() + " - " + testCaseStepExecution.getTestCase() + " - Step " + testCaseStepExecution.getStep() + " - Index " + testCaseStepExecution.getStep());698 if (execute_Step) {699 /**700 * We execute the step701 */702 testCaseStepExecution = this.executeStep(testCaseStepExecution, tCExecution);703 /**704 * Updating Execution Result Message only if705 * execution result message of the step is706 * not PE or OK.707 */708 if ((!(testCaseStepExecution.getExecutionResultMessage().equals(new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_TESTSTARTED))))709 && (!(testCaseStepExecution.getExecutionResultMessage().equals(new MessageGeneral(MessageGeneralEnum.EXECUTION_OK))))) {710 tCExecution.setResultMessage(testCaseStepExecution.getExecutionResultMessage());711 }712 if (testCaseStepExecution.getStepResultMessage().equals(new MessageEvent(MessageEventEnum.STEP_PENDING))) {713 testCaseStepExecution.setStepResultMessage(new MessageEvent(MessageEventEnum.STEP_SUCCESS));714 }715 testCaseStepExecutionService.updateTestCaseStepExecution(testCaseStepExecution);716 if (testCaseStepExecution.isStopExecution()) {717 break;718 }719 } else // We don't execute the step and record a generic execution.720 if ((!descriptionOrConditionStepDecodeError) && (!conditionStepError)) {721 /**722 * Register Step in database723 */724 LOG.debug(logPrefix + "Registering Step : " + testCaseStepExecution.getStep());725 // We change the Step message only if the Step is not executed due to condition.726 MessageEvent stepMes = new MessageEvent(MessageEventEnum.CONDITION_TESTCASESTEP_NOTEXECUTED);727 testCaseStepExecution.setStepResultMessage(stepMes);728 testCaseStepExecution.setReturnMessage(testCaseStepExecution.getReturnMessage()729 .replace("%COND%", testCaseStepExecution.getConditionOperator())730 .replace("%LOOP%", testCaseStepExecution.getLoop())731 .replace("%MESSAGE%", conditionAnswer.getResultMessage().getDescription())732 );733 testCaseStepExecution.setEnd(new Date().getTime());734 this.testCaseStepExecutionService.updateTestCaseStepExecution(testCaseStepExecution);735 LOG.debug(logPrefix + "Registered Step");736 } else {737 // Not executed because decode error or failed condition.738 testCaseStepExecution.setEnd(new Date().getTime());739 testCaseStepExecution.setStopExecution(true);740 this.testCaseStepExecutionService.updateTestCaseStepExecution(testCaseStepExecution);741 LOG.debug(logPrefix + "Registered Step");742 }743 /**744 * Log TestCaseStepExecution745 */746 if (tCExecution.getVerbose() > 0) {747 LOG.info(testCaseStepExecution.toJson(false, true));748 }749 // Websocket --> we refresh the corresponding Detail Execution pages attached to this execution.750 updateTCExecutionWebSocketOnly(tCExecution, false);751 step_index++;752 } while (execute_Next_Step && step_index <= maxloop);753 // Step execution boolean is considered for next step execution only if current step was not forced or forced and failed.754 if (!testCaseStep.getForceExe().equalsIgnoreCase("Y") || testCaseStepExecution.isStopExecution()) {755 doStepStopExecution = testCaseStepExecution.isStopExecution();756 }757 }758 }759 /**760 * If at that time the execution is still PE, we move it to761 * OK. It means that no issue were met.762 */763 if ((tCExecution.getResultMessage() == null) || (tCExecution.getResultMessage().equals(new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_TESTSTARTED)))) {764 tCExecution.setResultMessage(new MessageGeneral(MessageGeneralEnum.EXECUTION_OK));765 }766 /**767 * We notify external robot provider of end of execution768 * status.769 */770 switch (tCExecution.getRobotProvider()) {771 case TestCaseExecution.ROBOTPROVIDER_BROWSERSTACK:772 browserstackService.setSessionStatus(tCExecution.getSystem(), tCExecution.getRobotSessionID(), tCExecution.getControlStatus(), tCExecution.getControlMessage(), tCExecution.getRobotExecutorObj().getHostUser(), tCExecution.getRobotExecutorObj().getHostPassword());773 break;774 case TestCaseExecution.ROBOTPROVIDER_KOBITON:775 kobitonService.setSessionStatus(tCExecution.getSystem(), tCExecution.getRobotSessionID(), tCExecution.getControlStatus(), tCExecution.getControlMessage(), tCExecution.getRobotExecutorObj().getHostUser(), tCExecution.getRobotExecutorObj().getHostPassword());776 break;777 }778 } else { // We don't execute the testcase linked with condition.779 MessageGeneral mes;780 /**781 * Update Execution status from condition782 */783 if (conditionAnswerTc.getResultMessage().getMessage().getCodeString().equals("PE")) {784 mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_NE_CONDITION);785 } else {786 mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_CONDITION);787 }788 mes.setDescription(mes.getDescription().replace("%COND%", tCExecution.getConditionOperator())789 .replace("%MES%", conditionAnswerTc.getResultMessage().getDescription()));790 tCExecution.setResultMessage(mes);791 }792 }793 } catch (CerberusException ex) {794 /**795 * If an exception is found, set the execution to FA and print the796 * exception (only in debug mode)797 */798 MessageGeneral messageFin = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA);799 messageFin.setDescription(messageFin.getDescription() + " " + ex.getMessageError().getDescription());800 tCExecution.setResultMessage(messageFin);801 LOG.debug(logPrefix + "Exception found Executing Test " + tCExecution.getId() + " : " + ex.getMessageError().getDescription());802 } catch (Exception ex) {803 /**804 * If an exception is found, set the execution to FA and print the805 * exception806 */807 MessageGeneral messageFin = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA);808 messageFin.setDescription(messageFin.getDescription() + " " + ex.getMessage());809 tCExecution.setResultMessage(messageFin);810 tCExecution.setControlMessage(tCExecution.getControlMessage() + " Exception: " + ex);811 LOG.error(logPrefix + "Exception found Executing Test " + tCExecution.getId(), ex);812 } finally {813 /**814 * We stop the server session here (selenium for ex.).815 */816 try {817 if (videoRecorder != null) {818 videoRecorder.endRecordVideo();819 }820 tCExecution = this.stopTestCase(tCExecution);821 } catch (Exception ex) {822 LOG.error(logPrefix + "Exception Stopping Test " + tCExecution.getId() + " Exception : " + ex.toString(), ex);823 }824 /**825 * Log Execution826 */827 LOG.info(tCExecution.toJson(false));828 /**829 * Clean memory830 */831 try {832 executionUUID.removeExecutionUUID(tCExecution.getExecutionUUID());833 LOG.debug(logPrefix + "Clean ExecutionUUID");834 } catch (Exception ex) {835 LOG.error(logPrefix + "Exception cleaning Memory: " + ex.toString(), ex);836 }837 /**838 * Log execution is finished839 */840 LOG.info("Execution Finished : UUID=" + tCExecution.getExecutionUUID()841 + " ID=" + tCExecution.getId() + " RC=" + tCExecution.getControlStatus() + " "842 + "TestName=" + tCExecution.getEnvironment() + "." + tCExecution.getCountry() + "."843 + tCExecution.getBuild() + "." + tCExecution.getRevision() + "." + tCExecution.getTest() + "_"844 + tCExecution.getTestCase() + "_" + tCExecution.getTestCaseObj().getDescription().replace(".", ""));845 /**846 * Retry management, in case the result is not (OK or NE), we847 * execute the job again reducing the retry to 1.848 */849 boolean isRetried = retriesService.manageRetries(tCExecution);850 /**851 * Updating queue to done status only for execution from queue852 */853 if (tCExecution.getQueueID() != 0) {854 executionQueueService.updateToDone(tCExecution.getQueueID(), "", runID);855 }856 /**857 * After every execution finished, <br>858 * if the execution has a tag that has a campaign associated <br>859 * and no more executions are in the queue, <br>860 * we trigger : <br>861 * 1/ The update of the EndExeQueue of the tag <br>862 * 2/ We notify the Distribution List with execution report status863 */864 tagService.manageCampaignEndOfExecution(tCExecution.getTag());865 /**866 * Dependency management, At the end of the execution, we RELEASE867 * the corresponding dependencies and put corresponding Queue868 * entries to QUEUED status.869 */870 if (!isRetried) {871 testCaseExecutionQueueDepService.manageDependenciesEndOfExecution(tCExecution);872 }873 // After every execution finished we try to trigger more from the queue;-).874 executionThreadPoolService.executeNextInQueueAsynchroneously(false);875 }876 return tCExecution;877 }878 // Update Execution status and eventually push the new value to websocket.879 private void updateTCExecution(TestCaseExecution tCExecution, boolean forcePush) {880 try {881 testCaseExecutionService.updateTCExecution(tCExecution);882 } catch (CerberusException ex) {883 LOG.warn(ex);884 }885 updateTCExecutionWebSocketOnly(tCExecution, forcePush);886 }887 private void updateTCExecutionWebSocketOnly(TestCaseExecution tCExecution, boolean forcePush) {888 // Websocket --> we refresh the corresponding Detail Execution pages attached to this execution.889 if (tCExecution.isCerberus_featureflipping_activatewebsocketpush()) {890 TestCaseExecutionEndPoint.getInstance().send(tCExecution, forcePush);891 }892 }893 @Override894 public TestCaseExecution stopTestCase(TestCaseExecution tCExecution) {895 /**896 * Stop Execution897 */898 LOG.debug(tCExecution.getId() + " - Stop the execution " + tCExecution.getId() + " UUID:" + tCExecution.getExecutionUUID());899 try {900 //TODO:FN debug messages to be removed901 LOG.debug("[DEBUG] STOP " + " ID=" + tCExecution.getId());902 this.stopRunTestCase(tCExecution);903 } catch (Exception ex) {904 LOG.warn("Exception Stopping Execution " + tCExecution.getId() + " Exception :" + ex.toString());905 }906 /**907 * Saving TestCaseExecution object.908 */909 tCExecution.setEnd(new Date().getTime());910 try {911 testCaseExecutionService.updateTCExecution(tCExecution);912 } catch (CerberusException ex) {913 LOG.warn("Exception updating Execution :" + tCExecution.getId() + " Exception:" + ex.toString());914 }915 // Websocket --> we refresh the corresponding Detail Execution pages attached to this execution.916 if (tCExecution.isCerberus_featureflipping_activatewebsocketpush()) {917 TestCaseExecutionEndPoint.getInstance().send(tCExecution, true);918 TestCaseExecutionEndPoint.getInstance().end(tCExecution);919 }920 return tCExecution;921 }922 private TestCaseStepExecution executeStep(TestCaseStepExecution testCaseStepExecution, TestCaseExecution tcExecution) {923 long runID = testCaseStepExecution.getId();924 String logPrefix = runID + " - ";925 AnswerItem<String> answerDecode = new AnswerItem<>();926 // Initialise the Step Data List.927 List<TestCaseExecutionData> myStepDataList = new ArrayList<>();928 testCaseStepExecution.setTestCaseExecutionDataList(myStepDataList);929 // Initialise the Data List used to enter the action.930 /**931 * Iterate Actions932 */933 List<TestCaseStepAction> testCaseStepActionList = testCaseStepExecution.getTestCaseStep().getActions();934 LOG.debug("Getting list of actions of the step. " + testCaseStepActionList.size() + " action(s) to perform.");935 for (TestCaseStepAction testCaseStepAction : testCaseStepActionList) {936 /**937 * Start Execution of TestCaseStepAction938 */939 long startAction = new Date().getTime();940 /**941 * Create and Register TestCaseStepActionExecution.942 */943 TestCaseStepActionExecution testCaseStepActionExecution = factoryTestCaseStepActionExecution.create(944 testCaseStepExecution.getId(), testCaseStepAction.getTest(), testCaseStepAction.getTestCase(),945 testCaseStepAction.getStep(), testCaseStepExecution.getIndex(), testCaseStepAction.getSequence(), testCaseStepAction.getSort(), null, null,946 testCaseStepAction.getConditionOperator(), testCaseStepAction.getConditionVal1(), testCaseStepAction.getConditionVal2(), testCaseStepAction.getConditionVal3(),947 testCaseStepAction.getConditionVal1(), testCaseStepAction.getConditionVal2(), testCaseStepAction.getConditionVal3(),948 testCaseStepAction.getAction(), testCaseStepAction.getValue1(), testCaseStepAction.getValue2(), testCaseStepAction.getValue3(), testCaseStepAction.getValue1(),949 testCaseStepAction.getValue2(), testCaseStepAction.getValue3(),950 testCaseStepAction.getForceExeStatus(), startAction, startAction, startAction, startAction, new MessageEvent(MessageEventEnum.ACTION_PENDING),951 testCaseStepAction.getDescription(), testCaseStepAction, testCaseStepExecution);952 this.testCaseStepActionExecutionService.insertTestCaseStepActionExecution(testCaseStepActionExecution);953 /**954 * We populate the TestCase Action List955 */956 testCaseStepExecution.addTestCaseStepActionExecutionList(testCaseStepActionExecution);957 /**958 * If execution is not manual, evaluate the condition at the action959 * level960 */961 AnswerItem<Boolean> conditionAnswer;962 boolean conditionDecodeError = false;963 if (!tcExecution.getManualExecution().equals("Y")) {964 try {965 answerDecode = variableService.decodeStringCompletly(testCaseStepActionExecution.getConditionVal1(), tcExecution, null, false);966 testCaseStepActionExecution.setConditionVal1((String) answerDecode.getItem());967 if (!(answerDecode.isCodeStringEquals("OK"))) {968 // If anything wrong with the decode --> we stop here with decode message in the action result.969 testCaseStepActionExecution.setActionResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Action Condition Value1"));970 testCaseStepActionExecution.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));971 testCaseStepActionExecution.setStopExecution(answerDecode.getResultMessage().isStopTest());972 testCaseStepActionExecution.setEnd(new Date().getTime());973 LOG.debug("Action interupted due to decode 'Action Condition Value1' Error.");974 conditionDecodeError = true;975 }976 } catch (CerberusEventException cex) {977 LOG.warn(cex);978 }979 try {980 answerDecode = variableService.decodeStringCompletly(testCaseStepActionExecution.getConditionVal2(), tcExecution, null, false);981 testCaseStepActionExecution.setConditionVal2((String) answerDecode.getItem());982 if (!(answerDecode.isCodeStringEquals("OK"))) {983 // If anything wrong with the decode --> we stop here with decode message in the action result.984 testCaseStepActionExecution.setActionResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Action Condition Value2"));985 testCaseStepActionExecution.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));986 testCaseStepActionExecution.setStopExecution(answerDecode.getResultMessage().isStopTest());987 testCaseStepActionExecution.setEnd(new Date().getTime());988 LOG.debug("Action interupted due to decode 'Action Condition Value2' Error.");989 conditionDecodeError = true;990 }991 } catch (CerberusEventException cex) {992 LOG.warn(cex);993 }994 try {995 answerDecode = variableService.decodeStringCompletly(testCaseStepActionExecution.getConditionVal3(), tcExecution, null, false);996 testCaseStepActionExecution.setConditionVal3((String) answerDecode.getItem());997 if (!(answerDecode.isCodeStringEquals("OK"))) {998 // If anything wrong with the decode --> we stop here with decode message in the action result.999 testCaseStepActionExecution.setActionResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Action Condition Value3"));1000 testCaseStepActionExecution.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));1001 testCaseStepActionExecution.setStopExecution(answerDecode.getResultMessage().isStopTest());1002 testCaseStepActionExecution.setEnd(new Date().getTime());1003 LOG.debug("Action interupted due to decode 'Action Condition Value3' Error.");1004 conditionDecodeError = true;1005 }1006 } catch (CerberusEventException cex) {1007 LOG.warn(cex);1008 }1009 }1010 if (!(conditionDecodeError)) {1011 conditionAnswer = this.conditionService.evaluateCondition(testCaseStepActionExecution.getConditionOperator(), testCaseStepActionExecution.getConditionVal1(), testCaseStepActionExecution.getConditionVal2(), testCaseStepActionExecution.getConditionVal3(), tcExecution);1012 boolean execute_Action = (boolean) conditionAnswer.getItem();1013 /**1014 * If condition OK or if manual execution, then execute the1015 * action1016 */1017 if (conditionAnswer.getResultMessage().getMessage().getCodeString().equals("PE")1018 || tcExecution.getManualExecution().equals("Y")) {1019 // Execute or not the action here.1020 if (execute_Action || tcExecution.getManualExecution().equals("Y")) {1021 LOG.debug("Executing action : " + testCaseStepActionExecution.getAction() + " with val1 : " + testCaseStepActionExecution.getValue1()1022 + " and val2 : " + testCaseStepActionExecution.getValue2()1023 + " and val3 : " + testCaseStepActionExecution.getValue3());1024 /**1025 * We execute the Action1026 */1027 testCaseStepActionExecution = this.executeAction(testCaseStepActionExecution, tcExecution);1028 /**1029 * If Action or property reported to stop the testcase,1030 * we stop it and update the step with the message.1031 */1032 testCaseStepExecution.setStopExecution(testCaseStepActionExecution.isStopExecution());1033 if ((!(testCaseStepActionExecution.getExecutionResultMessage().equals(new MessageGeneral(MessageGeneralEnum.EXECUTION_OK))))1034 && (!(testCaseStepActionExecution.getExecutionResultMessage().equals(new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_TESTEXECUTING))))) {1035 testCaseStepExecution.setExecutionResultMessage(testCaseStepActionExecution.getExecutionResultMessage());1036 testCaseStepExecution.setStepResultMessage(testCaseStepActionExecution.getActionResultMessage());1037 }1038 if (testCaseStepActionExecution.isStopExecution()) {1039 break;1040 }1041 } else { // We don't execute the action and record a generic execution.1042 /**1043 * Record Screenshot, PageSource1044 */1045 testCaseStepActionExecution.addFileList(recorderService.recordExecutionInformationAfterStepActionandControl(testCaseStepActionExecution, null));1046 LOG.debug("Registering Action : " + testCaseStepActionExecution.getAction());1047 // We change the Action message only if the action is not executed due to condition.1048 MessageEvent actionMes = new MessageEvent(MessageEventEnum.CONDITION_TESTCASEACTION_NOTEXECUTED);1049 testCaseStepActionExecution.setActionResultMessage(actionMes);1050 testCaseStepActionExecution.setReturnMessage(testCaseStepActionExecution.getReturnMessage()1051 .replace("%COND%", testCaseStepActionExecution.getConditionOperator())1052 .replace("%MESSAGE%", conditionAnswer.getResultMessage().getDescription())1053 );1054 testCaseStepActionExecution.setEnd(new Date().getTime());1055 this.testCaseStepActionExecutionService.updateTestCaseStepActionExecution(testCaseStepActionExecution);1056 LOG.debug("Registered Action");1057 }1058 } else {1059 // Error when performing the condition evaluation. We force no execution (false)1060 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_CONDITION);1061 mes.setDescription(mes.getDescription()1062 .replace("%COND%", testCaseStepActionExecution.getConditionOperator())1063 .replace("%AREA%", "action ")1064 .replace("%MES%", conditionAnswer.getResultMessage().getDescription()));1065 testCaseStepActionExecution.setExecutionResultMessage(mes);1066 testCaseStepExecution.setExecutionResultMessage(testCaseStepActionExecution.getExecutionResultMessage());1067 testCaseStepActionExecution.setActionResultMessage(new MessageEvent(MessageEventEnum.CONDITION_TESTCASEACTION_FAILED)1068 .resolveDescription("AREA", "")1069 .resolveDescription("COND", testCaseStepActionExecution.getConditionOperator())1070 .resolveDescription("MESSAGE", conditionAnswer.getResultMessage().getDescription()));1071 testCaseStepExecution.setStepResultMessage(new MessageEvent(MessageEventEnum.CONDITION_TESTCASESTEP_FAILED)1072 .resolveDescription("AREA", "action ")1073 .resolveDescription("COND", testCaseStepActionExecution.getConditionOperator())1074 .resolveDescription("MESSAGE", conditionAnswer.getResultMessage().getDescription()));1075 if (testCaseStepActionExecution.getForceExeStatus().equals("PE")) {1076 testCaseStepActionExecution.setStopExecution(false);1077 MessageEvent actionMes = testCaseStepActionExecution.getActionResultMessage();1078 actionMes.setDescription(testCaseStepActionExecution.getActionResultMessage().getDescription() + " -- Execution forced to continue.");1079 testCaseStepActionExecution.setActionResultMessage(actionMes);1080 } else {1081 testCaseStepActionExecution.setStopExecution(true);1082 }1083 testCaseStepExecution.setStopExecution(testCaseStepActionExecution.isStopExecution());1084 testCaseStepActionExecution.setEnd(new Date().getTime());1085 this.testCaseStepActionExecutionService.updateTestCaseStepActionExecution(testCaseStepActionExecution);1086 LOG.debug("Action interupted due to condition error.");1087 // We stop any further Action execution.1088 if (testCaseStepActionExecution.isStopExecution()) {1089 break;1090 }1091 }1092 } else {1093 testCaseStepActionExecution.setEnd(new Date().getTime());1094 testCaseStepExecution.setExecutionResultMessage(testCaseStepActionExecution.getExecutionResultMessage());1095 testCaseStepExecution.setStepResultMessage(testCaseStepActionExecution.getActionResultMessage());1096 testCaseStepExecution.setStopExecution(testCaseStepActionExecution.isStopExecution());1097 this.testCaseStepActionExecutionService.updateTestCaseStepActionExecution(testCaseStepActionExecution);1098 LOG.debug("Registered Action");1099 if (testCaseStepActionExecution.isStopExecution()) {1100 break;1101 }1102 }1103 /**1104 * Log TestCaseStepActionExecution1105 */1106 if (tcExecution.getVerbose() > 0) {1107 LOG.info(testCaseStepActionExecution.toJson(false, true));1108 }1109 }1110 testCaseStepExecution.setEnd(new Date().getTime());1111 this.testCaseStepExecutionService.updateTestCaseStepExecution(testCaseStepExecution);1112 updateTCExecutionWebSocketOnly(tcExecution, false);1113 return testCaseStepExecution;1114 }1115 private TestCaseStepActionExecution executeAction(TestCaseStepActionExecution actionExe, TestCaseExecution exe) {1116 LOG.debug("Starting execute Action : " + actionExe.getAction());1117 AnswerItem<String> answerDecode = new AnswerItem<>();1118 /**1119 * If execution is not manual, do action and record files1120 */1121 if (!exe.getManualExecution().equals("Y")) {1122 actionExe = this.actionService.doAction(actionExe);1123 /**1124 * Record Screenshot, PageSource1125 */1126 try {1127 actionExe.addFileList(recorderService.recordExecutionInformationAfterStepActionandControl(actionExe, null));1128 } catch (Exception ex) {1129 LOG.warn("Unable to record Screenshot/PageSource : " + ex.toString(), ex);1130 }1131 } else {1132 /**1133 * If execution manual, set Action result message as notExecuted1134 */1135 actionExe.setActionResultMessage(new MessageEvent(MessageEventEnum.ACTION_WAITINGFORMANUALEXECUTION));1136 actionExe.setExecutionResultMessage(new MessageGeneral(MessageGeneralEnum.EXECUTION_WE));1137 actionExe.setEnd(new Date().getTime());1138 }1139 /**1140 * Register Action in database1141 */1142 LOG.debug("Registering Action : " + actionExe.getAction());1143 this.testCaseStepActionExecutionService.updateTestCaseStepActionExecution(actionExe);1144 LOG.debug("Registered Action");1145 if (actionExe.isStopExecution()) {1146 return actionExe;1147 }1148 // If Action setNetworkTrafficContent or setServiceCallContent is not executed, we don't execute the corresponding controls.1149 if (actionExe.getActionResultMessage().getCodeString().equals("NE")1150 && (actionExe.getAction().equals(TestCaseStepAction.ACTION_SETNETWORKTRAFFICCONTENT) || actionExe.getAction().equals(TestCaseStepAction.ACTION_SETNETWORKTRAFFICCONTENT))) {1151 return actionExe;1152 }1153 //As controls are associated with an action, the current state for the action is stored in order to restore it1154 //if some property is not defined for the country1155 MessageEvent actionMessage = actionExe.getActionResultMessage();1156 MessageGeneral excutionResultMessage = actionExe.getExecutionResultMessage();1157 /**1158 * Iterate Control1159 */1160 List<TestCaseStepActionControl> tcsacList = actionExe.getTestCaseStepAction().getControls();1161 for (TestCaseStepActionControl control : tcsacList) {1162 /**1163 * Start Execution of TestCAseStepActionControl1164 */1165 long startControl = new Date().getTime();1166 /**1167 * Create and Register TestCaseStepActionControlExecution1168 */1169 LOG.debug("Creating TestCaseStepActionControlExecution");1170 TestCaseStepActionControlExecution controlExe1171 = factoryTestCaseStepActionControlExecution.create(actionExe.getId(), control.getTest(), control.getTestCase(),1172 control.getStep(), actionExe.getIndex(), control.getSequence(), control.getControlSequence(), control.getSort(),1173 null, null,1174 control.getConditionOperator(), control.getConditionVal1(), control.getConditionVal2(), control.getConditionVal3(), control.getConditionVal1(), control.getConditionVal2(), control.getConditionVal3(),1175 control.getControl(), control.getValue1(), control.getValue2(), control.getValue3(), control.getValue1(), control.getValue2(),1176 control.getValue3(), control.getFatal(), startControl, 0, 0, 0,1177 control.getDescription(), actionExe, new MessageEvent(MessageEventEnum.CONTROL_PENDING));1178 this.testCaseStepActionControlExecutionService.insertTestCaseStepActionControlExecution(controlExe);1179 LOG.debug("Executing control : " + controlExe.getControlSequence() + " type : " + controlExe.getControl());1180 /**1181 * We populate the TestCase Control List1182 */1183 actionExe.addTestCaseStepActionExecutionList(controlExe);1184 // Evaluate the condition at the control level.1185 AnswerItem<Boolean> conditionAnswer;1186 boolean conditionDecodeError = false;1187 if (!exe.getManualExecution().equals("Y")) {1188 try {1189 answerDecode = variableService.decodeStringCompletly(controlExe.getConditionVal1(), exe, null, false);1190 controlExe.setConditionVal1((String) answerDecode.getItem());1191 if (!(answerDecode.isCodeStringEquals("OK"))) {1192 // If anything wrong with the decode --> we stop here with decode message in the action result.1193 controlExe.setControlResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Control Condition Value1"));1194 controlExe.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));1195 controlExe.setStopExecution(answerDecode.getResultMessage().isStopTest());1196 controlExe.setEnd(new Date().getTime());1197 LOG.debug("Control interupted due to decode 'Control Condition Value1' Error.");1198 conditionDecodeError = true;1199 }1200 } catch (CerberusEventException cex) {1201 LOG.warn(cex);1202 }1203 try {1204 answerDecode = variableService.decodeStringCompletly(controlExe.getConditionVal2(), exe, null, false);1205 controlExe.setConditionVal2((String) answerDecode.getItem());1206 if (!(answerDecode.isCodeStringEquals("OK"))) {1207 // If anything wrong with the decode --> we stop here with decode message in the action result.1208 controlExe.setControlResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Control Condition Value2"));1209 controlExe.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));1210 controlExe.setStopExecution(answerDecode.getResultMessage().isStopTest());1211 controlExe.setEnd(new Date().getTime());1212 LOG.debug("Control interupted due to decode 'Control Condition Value2' Error.");1213 conditionDecodeError = true;1214 }1215 } catch (CerberusEventException cex) {1216 LOG.warn(cex);1217 }1218 try {1219 answerDecode = variableService.decodeStringCompletly(controlExe.getConditionVal3(), exe, null, false);1220 controlExe.setConditionVal3((String) answerDecode.getItem());1221 if (!(answerDecode.isCodeStringEquals("OK"))) {1222 // If anything wrong with the decode --> we stop here with decode message in the action result.1223 controlExe.setControlResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Control Condition Value3"));1224 controlExe.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));1225 controlExe.setStopExecution(answerDecode.getResultMessage().isStopTest());1226 controlExe.setEnd(new Date().getTime());1227 LOG.debug("Control interupted due to decode 'Control Condition Value3' Error.");1228 conditionDecodeError = true;1229 }1230 } catch (CerberusEventException cex) {1231 LOG.warn(cex);1232 }1233 }1234 if (!(conditionDecodeError)) {1235 conditionAnswer = this.conditionService.evaluateCondition(controlExe.getConditionOperator(), controlExe.getConditionVal1(), controlExe.getConditionVal2(), controlExe.getConditionVal3(), exe);1236 boolean execute_Control = (boolean) conditionAnswer.getItem();1237 /**1238 * If condition OK or if manual execution, then execute the1239 * control1240 */1241 if (conditionAnswer.getResultMessage().getMessage().getCodeString().equals("PE")1242 || exe.getManualExecution().equals("Y")) {1243 if (execute_Control || exe.getManualExecution().equals("Y")) {1244 /**1245 * We execute the control1246 */1247 controlExe = executeControl(controlExe, exe);1248 /**1249 * We update the Action with the execution message and1250 * stop flag from the control. We update the status only1251 * if the control is not OK. This is to prevent moving1252 * the status to OK when it should stay KO when a1253 * control failed previously.1254 */1255 actionExe.setStopExecution(controlExe.isStopExecution());1256 if (!(controlExe.getControlResultMessage().equals(new MessageEvent(MessageEventEnum.CONTROL_SUCCESS)))) {1257 //NA is a special case of not having success while calculating the property; the action shouldn't be stopped1258 if (controlExe.getControlResultMessage().equals(new MessageEvent(MessageEventEnum.PROPERTY_FAILED_NO_PROPERTY_DEFINITION))) {1259 //restores the messages information if the property is not defined for the country1260 actionExe.setActionResultMessage(actionMessage);1261 actionExe.setExecutionResultMessage(excutionResultMessage);1262 } else {1263 actionExe.setExecutionResultMessage(controlExe.getExecutionResultMessage());1264 actionExe.setActionResultMessage(controlExe.getControlResultMessage());1265 }1266 }1267 /**1268 * If Control reported to stop the testcase, we stop it.1269 */1270 if (controlExe.isStopExecution()) {1271 break;1272 }1273 } else { // We don't execute the control and record a generic execution.1274 /**1275 * Record Screenshot, PageSource1276 */1277 controlExe.addFileList(recorderService.recordExecutionInformationAfterStepActionandControl(controlExe.getTestCaseStepActionExecution(), controlExe));1278 /**1279 * Register Control in database1280 */1281 LOG.debug("Registering Control : " + controlExe.getControlSequence());1282 // We change the Action message only if the action is not executed due to condition.1283 MessageEvent controlMes = new MessageEvent(MessageEventEnum.CONDITION_TESTCASECONTROL_NOTEXECUTED);1284 controlExe.setControlResultMessage(controlMes);1285 controlExe.setReturnMessage(controlExe.getReturnMessage()1286 .replace("%COND%", controlExe.getConditionOperator())1287 .replace("%MESSAGE%", conditionAnswer.getResultMessage().getDescription())1288 );1289 controlExe.setEnd(new Date().getTime());1290 this.testCaseStepActionControlExecutionService.updateTestCaseStepActionControlExecution(controlExe);1291 LOG.debug("Registered Control");1292 // Websocket --> we refresh the corresponding Detail Execution pages attached to this execution.1293 updateTCExecutionWebSocketOnly(exe, false);1294 }1295 } else {1296 // Error when performing the condition evaluation. We force no execution (false)1297 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_CONDITION);1298 mes.setDescription(mes.getDescription()1299 .replace("%COND%", controlExe.getConditionOperator())1300 .replace("%AREA%", "control ")1301 .replace("%MES%", conditionAnswer.getResultMessage().getDescription()));1302 controlExe.setExecutionResultMessage(mes);1303 actionExe.setExecutionResultMessage(mes);1304 controlExe.setControlResultMessage(new MessageEvent(MessageEventEnum.CONDITION_TESTCASECONTROL_FAILED)1305 .resolveDescription("AREA", "")1306 .resolveDescription("COND", controlExe.getConditionOperator())1307 .resolveDescription("MESSAGE", conditionAnswer.getResultMessage().getDescription()));1308 actionExe.setActionResultMessage(new MessageEvent(MessageEventEnum.CONDITION_TESTCASEACTION_FAILED)1309 .resolveDescription("AREA", "control ")1310 .resolveDescription("COND", controlExe.getConditionOperator())1311 .resolveDescription("MESSAGE", conditionAnswer.getResultMessage().getDescription()));1312 controlExe.setEnd(new Date().getTime());1313 this.testCaseStepActionControlExecutionService.updateTestCaseStepActionControlExecution(controlExe);1314 LOG.debug("Control interupted due to condition error.");1315 // We stop any further Control execution.1316 break;1317 }1318 } else {1319 controlExe.setEnd(new Date().getTime());1320 actionExe.setExecutionResultMessage(controlExe.getExecutionResultMessage());1321 actionExe.setActionResultMessage(controlExe.getControlResultMessage());1322 this.testCaseStepActionControlExecutionService.updateTestCaseStepActionControlExecution(controlExe);1323 LOG.debug("Registered Control");1324 // Websocket --> we refresh the corresponding Detail Execution pages attached to this execution....

Full Screen

Full Screen

Source:TestCaseStepActionExecutionDAO.java Github

copy

Full Screen

...326 preStat.setInt(i++, testCaseStepActionExecution.getStep());327 preStat.setInt(i++, testCaseStepActionExecution.getIndex());328 preStat.setInt(i++, testCaseStepActionExecution.getSequence());329 preStat.setInt(i++, testCaseStepActionExecution.getSort());330 preStat.setString(i++, testCaseStepActionExecution.getConditionOperator());331 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getConditionVal1Init(), 65000));332 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getConditionVal2Init(), 65000));333 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getConditionVal3Init(), 65000));334 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getConditionVal1(), 65000));335 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getConditionVal2(), 65000));336 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getConditionVal3(), 65000));337 preStat.setString(i++, testCaseStepActionExecution.getAction());338 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getValue1Init(), 65000));339 preStat.setString(i++, StringUtil.getLeftString(ParameterParserUtil.securePassword(testCaseStepActionExecution.getValue2Init(), testCaseStepActionExecution.getPropertyName()), 65000));340 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getValue3Init(), 65000));341 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getValue1(), 65000));342 preStat.setString(i++, StringUtil.getLeftString(ParameterParserUtil.securePassword(testCaseStepActionExecution.getValue2(), testCaseStepActionExecution.getPropertyName()), 65000));343 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getValue3(), 65000));344 preStat.setString(i++, testCaseStepActionExecution.getForceExeStatus());345 if (testCaseStepActionExecution.getStart() != 0) {346 preStat.setTimestamp(i++, new Timestamp(testCaseStepActionExecution.getStart()));347 } else {348 preStat.setString(i++, "1970-01-01 01:01:01");349 }350 if (testCaseStepActionExecution.getEnd() != 0) {351 preStat.setTimestamp(i++, new Timestamp(testCaseStepActionExecution.getEnd()));352 } else {353 preStat.setString(i++, "1970-01-01 01:01:01");354 }355 DateFormat df = new SimpleDateFormat(DateUtil.DATE_FORMAT_TIMESTAMP);356 preStat.setString(i++, df.format(testCaseStepActionExecution.getStart()));357 preStat.setString(i++, df.format(testCaseStepActionExecution.getEnd()));358 preStat.setString(i++, testCaseStepActionExecution.getReturnCode());359 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getReturnMessage(), 65000));360 preStat.setString(i++, testCaseStepActionExecution.getTest());361 preStat.setString(i++, testCaseStepActionExecution.getTestCase());362 preStat.setString(i++, testCaseStepActionExecution.getDescription());363 preStat.executeUpdate();364 } catch (SQLException exception) {365 LOG.error("Unable to execute query : " + exception.toString());366 } finally {367 preStat.close();368 }369 } catch (SQLException exception) {370 LOG.error("Unable to execute query : " + exception.toString());371 } finally {372 try {373 if (connection != null) {374 connection.close();375 }376 } catch (SQLException e) {377 LOG.warn(e.toString());378 }379 }380 }381 @Override382 public void updateTestCaseStepActionExecution(TestCaseStepActionExecution testCaseStepActionExecution) {383 final String query = "UPDATE testcasestepactionexecution SET ACTION = ?, value1 = ?, value2 = ?, value3 = ?, forceExeStatus = ?, start = ?, END = ?"384 + ", startlong = ?, endlong = ?, returnCode = ?, returnMessage = ?, description = ?, sort = ?"385 + ", value1Init = ?, Value2Init = ?, value3Init = ?, conditionOperator = ?, "386 + "conditionVal1 = ?, conditionVal2 = ?, conditionVal3 = ?, conditionVal1Init = ?, conditionVal2Init = ?, conditionVal3Init = ?"387 + " WHERE id = ? AND test = ? AND testcase = ? AND step = ? AND `index` = ? AND sequence = ? ;";388 // Debug message on SQL.389 if (LOG.isDebugEnabled()) {390 LOG.debug("SQL : " + query);391 LOG.debug("SQL.param.id : " + testCaseStepActionExecution.getId());392 LOG.debug("SQL.param.test : " + testCaseStepActionExecution.getTest());393 LOG.debug("SQL.param.testcase : " + testCaseStepActionExecution.getTestCase());394 LOG.debug("SQL.param.step : " + testCaseStepActionExecution.getStep());395 LOG.debug("SQL.param.index : " + testCaseStepActionExecution.getIndex());396 LOG.debug("SQL.param.sequence : " + testCaseStepActionExecution.getSequence());397 }398 Connection connection = this.databaseSpring.connect();399 try {400 PreparedStatement preStat = connection.prepareStatement(query);401 try {402 int i = 1;403 preStat.setString(i++, testCaseStepActionExecution.getAction());404 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getValue1(), 65000));405 preStat.setString(i++, StringUtil.getLeftString(ParameterParserUtil.securePassword(testCaseStepActionExecution.getValue2(), testCaseStepActionExecution.getPropertyName()), 65000));406 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getValue3(), 65000));407 preStat.setString(i++, testCaseStepActionExecution.getForceExeStatus());408 if (testCaseStepActionExecution.getStart() != 0) {409 preStat.setTimestamp(i++, new Timestamp(testCaseStepActionExecution.getStart()));410 } else {411 preStat.setString(i++, "1970-01-01 01:01:01");412 }413 if (testCaseStepActionExecution.getEnd() != 0) {414 preStat.setTimestamp(i++, new Timestamp(testCaseStepActionExecution.getEnd()));415 } else {416 preStat.setString(i++, "1970-01-01 01:01:01");417 }418 DateFormat df = new SimpleDateFormat(DateUtil.DATE_FORMAT_TIMESTAMP);419 preStat.setString(i++, df.format(testCaseStepActionExecution.getStart()));420 preStat.setString(i++, df.format(testCaseStepActionExecution.getEnd()));421 preStat.setString(i++, testCaseStepActionExecution.getReturnCode());422 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getReturnMessage(), 65000));423 preStat.setString(i++, testCaseStepActionExecution.getDescription());424 preStat.setInt(i++, testCaseStepActionExecution.getSort());425 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getValue1Init(), 65000));426 preStat.setString(i++, StringUtil.getLeftString(ParameterParserUtil.securePassword(testCaseStepActionExecution.getValue2Init(), testCaseStepActionExecution.getPropertyName()), 65000));427 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getValue3Init(), 65000));428 preStat.setString(i++, testCaseStepActionExecution.getConditionOperator());429 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getConditionVal1(), 65000));430 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getConditionVal2(), 65000));431 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getConditionVal3(), 65000));432 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getConditionVal1Init(), 65000));433 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getConditionVal2Init(), 65000));434 preStat.setString(i++, StringUtil.getLeftString(testCaseStepActionExecution.getConditionVal3Init(), 65000));435 preStat.setLong(i++, testCaseStepActionExecution.getId());436 preStat.setString(i++, testCaseStepActionExecution.getTest());437 preStat.setString(i++, testCaseStepActionExecution.getTestCase());438 preStat.setInt(i++, testCaseStepActionExecution.getStep());439 preStat.setInt(i++, testCaseStepActionExecution.getIndex());440 preStat.setInt(i++, testCaseStepActionExecution.getSequence());441 preStat.executeUpdate();442 } catch (SQLException exception) {...

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2public class TestCaseStepActionExecution {3 private String conditionOperator;4 public String getConditionOperator() {5 return conditionOperator;6 }7 public void setConditionOperator(String conditionOperator) {8 this.conditionOperator = conditionOperator;9 }10}11package org.cerberus.crud.entity;12public class TestCaseStepActionExecution {13 private String conditionValue1;14 public String getConditionValue1() {15 return conditionValue1;16 }17 public void setConditionValue1(String conditionValue1) {18 this.conditionValue1 = conditionValue1;19 }20}21package org.cerberus.crud.entity;22public class TestCaseStepActionExecution {23 private String conditionValue2;24 public String getConditionValue2() {25 return conditionValue2;26 }27 public void setConditionValue2(String conditionValue2) {28 this.conditionValue2 = conditionValue2;29 }30}31package org.cerberus.crud.entity;32public class TestCaseStepActionExecution {33 private String conditionValue3;34 public String getConditionValue3() {35 return conditionValue3;36 }37 public void setConditionValue3(String conditionValue3) {38 this.conditionValue3 = conditionValue3;39 }40}41package org.cerberus.crud.entity;42public class TestCaseStepActionExecution {43 private String conditionValue1Init;44 public String getConditionValue1Init() {45 return conditionValue1Init;46 }47 public void setConditionValue1Init(String conditionValue1Init) {48 this.conditionValue1Init = conditionValue1Init;49 }50}

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

1import org.cerberus.crud.entity.TestCaseStepActionExecution;2public class 3 {3 public static void main(String[] args) {4 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();5 testCaseStepActionExecution.getConditionOperator();6 }7}8import org.cerberus.crud.entity.TestCaseStepActionExecution;9public class 4 {10 public static void main(String[] args) {11 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();12 testCaseStepActionExecution.getConditionOperator();13 }14}15import org.cerberus.crud.entity.TestCaseStepActionExecution;16public class 5 {17 public static void main(String[] args) {18 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();19 testCaseStepActionExecution.getConditionOperator();20 }21}22import org.cerberus.crud.entity.TestCaseStepActionExecution;23public class 6 {24 public static void main(String[] args) {25 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();26 testCaseStepActionExecution.getConditionOperator();27 }28}29import org.cerberus.crud.entity.TestCaseStepActionExecution;30public class 7 {31 public static void main(String[] args) {32 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();33 testCaseStepActionExecution.getConditionOperator();34 }35}36import org.cerberus.crud.entity.TestCaseStepActionExecution;37public class 8 {38 public static void main(String[] args) {39 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();40 testCaseStepActionExecution.getConditionOperator();41 }42}

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import org.cerberus.crud.entity.TestCaseStepActionExecution;3public class TestCaseStepActionExecutionTest {4 public static void main(String[] args) {5 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();6 testCaseStepActionExecution.setConditionOperator("conditionOperator");7 String result = testCaseStepActionExecution.getConditionOperator();8 System.out.println(result);9 }10}11package org.cerberus.crud.entity;12import org.cerberus.crud.entity.TestCaseStepActionExecution;13public class TestCaseStepActionExecutionTest {14 public static void main(String[] args) {15 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();16 testCaseStepActionExecution.setConditionValue1("conditionValue1");17 String result = testCaseStepActionExecution.getConditionValue1();18 System.out.println(result);19 }20}21package org.cerberus.crud.entity;22import org.cerberus.crud.entity.TestCaseStepActionExecution;23public class TestCaseStepActionExecutionTest {24 public static void main(String[] args) {25 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();26 testCaseStepActionExecution.setConditionValue2("conditionValue2");27 String result = testCaseStepActionExecution.getConditionValue2();28 System.out.println(result);29 }30}31package org.cerberus.crud.entity;32import org.cerberus.crud.entity.TestCaseStepActionExecution;33public class TestCaseStepActionExecutionTest {34 public static void main(String[] args) {35 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();36 testCaseStepActionExecution.setConditionValue3("conditionValue3");37 String result = testCaseStepActionExecution.getConditionValue3();38 System.out.println(result);39 }40}

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import org.cerberus.crud.entity.TestCaseStepActionExecution;3public class TestCaseStepActionExecutionTest {4 public static void main(String[] args) {5 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();6 testCaseStepActionExecution.setConditionOperator("=");7 String result = testCaseStepActionExecution.getConditionOperator();8 System.out.println(result);9 }10}11package org.cerberus.crud.entity;12import org.cerberus.crud.entity.TestCaseStepActionExecution;13public class TestCaseStepActionExecutionTest {14 public static void main(String[] args) {15 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();16 testCaseStepActionExecution.setConditionValue1("test");17 String result = testCaseStepActionExecution.getConditionValue1();18 System.out.println(result);19 }20}21package org.cerberus.crud.entity;22import org.cerberus.crud.entity.TestCaseStepActionExecution;23public class TestCaseStepActionExecutionTest {24 public static void main(String[] args) {25 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();26 testCaseStepActionExecution.setConditionValue2("test");27 String result = testCaseStepActionExecution.getConditionValue2();28 System.out.println(result);29 }30}31package org.cerberus.crud.entity;32import org.cerberus.crud.entity.TestCaseStepActionExecution;33public class TestCaseStepActionExecutionTest {34 public static void main(String[] args) {35 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();36 testCaseStepActionExecution.setConditionValue3("test");37 String result = testCaseStepActionExecution.getConditionValue3();38 System.out.println(result);39 }40}

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import org.cerberus.crud.entity.TestCaseStepActionExecution;3import org.cerberus.crud.entity.TestCaseStepActionExecution;4public class TestCaseStepActionExecution {5 private String conditionOperator;6 public String getConditionOperator() {7 return conditionOperator;8 }9 public void setConditionOperator(String conditionOperator) {10 this.conditionOperator = conditionOperator;11 }12}13package org.cerberus.crud.entity;14import org.cerberus.crud.entity.TestCaseStepActionExecution;15import org.cerberus.crud.entity.TestCaseStepActionExecution;16public class TestCaseStepActionExecution {17 private String conditionValue1;18 public String getConditionValue1() {19 return conditionValue1;20 }21 public void setConditionValue1(String conditionValue1) {22 this.conditionValue1 = conditionValue1;23 }24}25package org.cerberus.crud.entity;26import org.cerberus.crud.entity.TestCaseStepActionExecution;27import org.cerberus.crud.entity.TestCaseStepActionExecution;28public class TestCaseStepActionExecution {29 private String conditionValue2;30 public String getConditionValue2() {31 return conditionValue2;32 }33 public void setConditionValue2(String conditionValue2) {34 this.conditionValue2 = conditionValue2;35 }36}37package org.cerberus.crud.entity;38import org.cerberus.crud.entity.TestCaseStepActionExecution;39import org.cerberus.crud.entity.TestCaseStepActionExecution;40public class TestCaseStepActionExecution {41 private String conditionValue3;42 public String getConditionValue3() {43 return conditionValue3;44 }45 public void setConditionValue3(String conditionValue3) {46 this.conditionValue3 = conditionValue3;47 }48}

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import org.cerberus.crud.entity.TestCaseStepActionExecution;3import org.cerberus.crud.entity.TestCaseStepActionExecution;4public class TestCaseStepActionExecutionConditionOperator {5 public static void main(String[] args) {6 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();7 testCaseStepActionExecution.setConditionOperator("AND");8 System.out.println(testCaseStepActionExecution.getConditionOperator());9 }10}11package org.cerberus.crud.entity;12import org.cerberus.crud.entity.TestCaseStepActionExecution;13import org.cerberus.crud.entity.TestCaseStepActionExecution;14public class TestCaseStepActionExecutionConditionOperator {15 public static void main(String[] args) {16 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();17 testCaseStepActionExecution.setConditionOperator("AND");18 System.out.println(testCaseStepActionExecution.getConditionOperator());19 }20}21package org.cerberus.crud.entity;22import org.cerberus.crud.entity.TestCaseStepActionExecution;23import org.cerberus.crud.entity.TestCaseStepActionExecution;24public class TestCaseStepActionExecutionConditionValue1 {25 public static void main(String[] args) {26 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();27 testCaseStepActionExecution.setConditionValue1("test");28 System.out.println(testCaseStepActionExecution.getConditionValue1());29 }30}31package org.cerberus.crud.entity;32import org.cerberus.crud.entity.TestCaseStepActionExecution;33import org.cerberus.crud.entity.TestCaseStepActionExecution;34public class TestCaseStepActionExecutionConditionValue1 {35 public static void main(String[] args) {36 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();37 testCaseStepActionExecution.setConditionValue1("test");38 System.out.println(testCaseStepAction

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import org.cerberus.crud.entity.TestCaseStepActionExecution;3import org.cerberus.crud.entity.TestCaseStepActionExecution;4public class TestCaseStepActionExecution {5 private String conditionOperator;6 public String getConditionOperator() {7 return conditionOperator;8 }9 public void setConditionOperator(String conditionOperator) {10 this.conditionOperator = conditionOperator;11 }12}13package org.cerberus.crud.entity;14import org.cerberus.crud.entity.TestCaseStepActionExecution;15import org.cerberus.crud.entity.TestCaseStepActionExecution;16public class TestCaseStepActionExecution {17 private String conditionOperator;18 public String getConditionOperator() {19 return conditionOperator;20 }21 public void setConditionOperator(String conditionOperator) {22 this.conditionOperator = conditionOperator;23 }24}25package org.cerberus.crud.entity;26import org.cerberus.crud.entity.TestCaseStepActionExecution;27import org.cerberus.crud.entity.TestCaseStepActionExecution;28public class TestCaseStepActionExecution {29 private String conditionOperator;30 public String getConditionOperator() {31 return conditionOperator;32 }33 public void setConditionOperator(String conditionOperator) {34 this.conditionOperator = conditionOperator;35 }36}37package org.cerberus.crud.entity;38import org.cerberus.crud.entity.TestCaseStepActionExecution;39import org.cerberus.crud.entity.TestCaseStepActionExecution;40public class TestCaseStepActionExecution {41 private String conditionOperator;42 public String getConditionOperator() {43 return conditionOperator;44 }45 public void setConditionOperator(String conditionOperator) {46 this.conditionOperator = conditionOperator;47 }48}

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import org.cerberus.crud.entity.TestCaseStepActionExecution;3public class TestCaseStepActionExecutionGetConditionOperator {4 public static void main(String[] args) {5 TestCaseStepActionExecution tcse = new TestCaseStepActionExecution();6 tcse.setConditionOperator("AND");7 System.out.println("Condition Operator is: " + tcse.getConditionOperator());8 }9}10package org.cerberus.crud.entity;11import org.cerberus.crud.entity.TestCaseStepActionExecution;12public class TestCaseStepActionExecutionGetConditionValue1 {13 public static void main(String[] args) {14 TestCaseStepActionExecution tcse = new TestCaseStepActionExecution();15 tcse.setConditionValue1("value1");16 System.out.println("Condition Value1 is: " + tcse.getConditionValue1());17 }18}19package org.cerberus.crud.entity;20import org.cerberus.crud.entity.TestCaseStepActionExecution;21public class TestCaseStepActionExecutionGetConditionValue2 {22 public static void main(String[] args) {23 TestCaseStepActionExecution tcse = new TestCaseStepActionExecution();24 tcse.setConditionValue2("value2");25 System.out.println("Condition Value2 is: " + tcse.getConditionValue2());26 }27}28package org.cerberus.crud.entity;29import org.c

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

1public class getConditionOperator {2 public static void main(String[] args) {3 TestCaseStepActionExecution obj = new TestCaseStepActionExecution();4 obj.setConditionOperator("conditionOperator");5 System.out.println(obj.getConditionOperator());6 }7}8public class setConditionOperator {9 public static void main(String[] args) {10 TestCaseStepActionExecution obj = new TestCaseStepActionExecution();11 obj.setConditionOperator("conditionOperator");12 System.out.println(obj.getConditionOperator());13 }14}15public class getConditionValue1 {16 public static void main(String[] args) {17 TestCaseStepActionExecution obj = new TestCaseStepActionExecution();18 obj.setConditionValue1("conditionValue1");19 System.out.println(obj.getConditionValue1());20 }21}22public class setConditionValue1 {23 public static void main(String[] args) {24 TestCaseStepActionExecution obj = new TestCaseStepActionExecution();25 obj.setConditionValue1("conditionValue1");26 System.out.println(obj.getConditionValue1());27 }28}29public class getConditionValue2 {30 public static void main(String[] args)

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

1package org.cerberus.test;2import org.cerberus.crud.entity.TestCaseStepActionExecution;3public class TestGetConditionOperator {4 public static void main(String[] args) {5 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();6 String conditionOperator = testCaseStepActionExecution.getConditionOperator();7 System.out.println(conditionOperator);8 }9}10package org.cerberus.test;11import org.cerberus.crud.entity.TestCaseStepActionExecution;12public class TestSetConditionOperator {13 public static void main(String[] args) {14 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();15 testCaseStepActionExecution.setConditionOperator("AND");16 }17}18package org.cerberus.test;19import org.cerberus.crud.entity.TestCaseStepActionExecution;20public class TestGetConditionValue1 {21 public static void main(String[] args) {22 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();23 String conditionValue1 = testCaseStepActionExecution.getConditionValue1();24 System.out.println(conditionValue1);25 }26}27package org.cerberus.test;28import org.cerberus.crud.entity.TestCaseStepActionExecution;29public class TestSetConditionValue1 {30 public static void main(String[] args) {31 TestCaseStepActionExecution testCaseStepActionExecution = new TestCaseStepActionExecution();32 testCaseStepActionExecution.setConditionValue1("OK");33 }34}

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.

Run Cerberus-source automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful