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

Best Cerberus-source code snippet using org.cerberus.crud.entity.TestCaseStepExecution.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:TestCaseStepExecutionDAO.java Github

copy

Full Screen

...91 DateFormat df = new SimpleDateFormat(DateUtil.DATE_FORMAT_TIMESTAMP);92 preStat.setString(i++, df.format(testCaseStepExecution.getStart()));93 preStat.setString(i++, StringUtil.getLeftString(testCaseStepExecution.getReturnMessage(), 65000));94 preStat.setString(i++, testCaseStepExecution.getDescription());95 preStat.setString(i++, testCaseStepExecution.getConditionOperator());96 preStat.setString(i++, StringUtil.getLeftString(testCaseStepExecution.getConditionVal1Init(), 65000));97 preStat.setString(i++, StringUtil.getLeftString(testCaseStepExecution.getConditionVal2Init(), 65000));98 preStat.setString(i++, StringUtil.getLeftString(testCaseStepExecution.getConditionVal3Init(), 65000));99 preStat.setString(i++, StringUtil.getLeftString(testCaseStepExecution.getConditionVal1(), 65000));100 preStat.setString(i++, StringUtil.getLeftString(testCaseStepExecution.getConditionVal2(), 65000));101 preStat.setString(i++, StringUtil.getLeftString(testCaseStepExecution.getConditionVal3(), 65000));102 preStat.executeUpdate();103 } catch (SQLException exception) {104 LOG.error("Unable to execute query : " + exception.toString());105 } finally {106 preStat.close();107 }108 } catch (SQLException exception) {109 LOG.error("Unable to execute query : " + exception.toString());110 } finally {111 try {112 if (connection != null) {113 connection.close();114 }115 } catch (SQLException e) {116 LOG.warn(e.toString());117 }118 }119 }120 @Override121 public void updateTestCaseStepExecution(TestCaseStepExecution testCaseStepExecution) {122 final String query = "UPDATE testcasestepexecution SET returncode = ?, start = ?, fullstart = ?, end = ?, fullend = ?, timeelapsed = ?, "123 + "returnmessage = ?, description = ?, sort = ?, `loop` = ?, conditionOperator = ?, conditionVal1Init = ?, conditionVal2Init = ?, conditionVal3Init = ?, "124 + "conditionVal1 = ?, conditionVal2 = ?, conditionVal3 = ? "125 + "WHERE id = ? AND step = ? AND `index` = ? AND test = ? AND testcase = ?";126 // Debug message on SQL.127 if (LOG.isDebugEnabled()) {128 LOG.debug("SQL : " + query);129 LOG.debug("SQL.param.id : " + testCaseStepExecution.getId());130 LOG.debug("SQL.param.test : " + testCaseStepExecution.getTest());131 LOG.debug("SQL.param.testcase : " + testCaseStepExecution.getTestCase());132 LOG.debug("SQL.param.step : " + testCaseStepExecution.getStep());133 LOG.debug("SQL.param.index : " + testCaseStepExecution.getIndex());134 }135 Connection connection = this.databaseSpring.connect();136 try {137 Timestamp timeStart = new Timestamp(testCaseStepExecution.getStart());138 Timestamp timeEnd = new Timestamp(testCaseStepExecution.getEnd());139 PreparedStatement preStat = connection.prepareStatement(query);140 try {141 int i = 1;142 DateFormat df = new SimpleDateFormat(DateUtil.DATE_FORMAT_TIMESTAMP);143 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCaseStepExecution.getReturnCode(), ""));144 preStat.setTimestamp(i++, timeStart);145 preStat.setString(i++, df.format(timeStart));146 preStat.setTimestamp(i++, timeEnd);147 preStat.setString(i++, df.format(timeEnd));148 preStat.setFloat(i++, (timeEnd.getTime() - timeStart.getTime()) / (float) 1000);149 preStat.setString(i++, StringUtil.getLeftString(testCaseStepExecution.getReturnMessage(), 65000));150 preStat.setString(i++, testCaseStepExecution.getDescription());151 preStat.setInt(i++, testCaseStepExecution.getSort());152 preStat.setString(i++, testCaseStepExecution.getLoop());153 preStat.setString(i++, testCaseStepExecution.getConditionOperator());154 preStat.setString(i++, StringUtil.getLeftString(testCaseStepExecution.getConditionVal1Init(), 65000));155 preStat.setString(i++, StringUtil.getLeftString(testCaseStepExecution.getConditionVal2Init(), 65000));156 preStat.setString(i++, StringUtil.getLeftString(testCaseStepExecution.getConditionVal3Init(), 65000));157 preStat.setString(i++, StringUtil.getLeftString(testCaseStepExecution.getConditionVal1(), 65000));158 preStat.setString(i++, StringUtil.getLeftString(testCaseStepExecution.getConditionVal2(), 65000));159 preStat.setString(i++, StringUtil.getLeftString(testCaseStepExecution.getConditionVal3(), 65000));160 preStat.setLong(i++, testCaseStepExecution.getId());161 preStat.setInt(i++, testCaseStepExecution.getStep());162 preStat.setInt(i++, testCaseStepExecution.getIndex());163 preStat.setString(i++, testCaseStepExecution.getTest());164 preStat.setString(i++, testCaseStepExecution.getTestCase());165 preStat.executeUpdate();166 } catch (SQLException exception) {167 LOG.error("Unable to execute query : " + exception.toString());...

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

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

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import org.cerberus.crud.entity.TestCaseStepExecution;3public class TestCaseStepExecutionGetConditionOperator {4 public static void main(String[] args) {5 TestCaseStepExecution testCaseStepExecution = new TestCaseStepExecution();6 String conditionOperator = testCaseStepExecution.getConditionOperator();7 System.out.println(conditionOperator);8 }9}

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

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

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import org.cerberus.engine.entity.MessageEvent;3import org.cerberus.util.StringUtil;4import org.json.JSONArray;5import org.json.JSONException;6import org.json.JSONObject;7import org.springframework.context.ApplicationContext;8import java.io.Serializable;9import java.util.ArrayList;10import java.util.List;11public class TestCaseStepExecution implements Serializable {12 private Integer id;13 private String test;14 private String testCase;15 private Integer testCaseVersion;16 private Integer step;17 private String conditionOperator;18 private String conditionVal1Init;19 private String conditionVal2Init;20 private String conditionVal1;21 private String conditionVal2;22 private String conditionVal1Options;23 private String conditionVal2Options;24 private String conditionOptions;25 private String conditionDatabase;26 private String conditionValue1;27 private String conditionValue2;28 private String conditionValue3;29 private String conditionValue4;30 private String conditionValue5;31 private String conditionValue6;32 private String conditionValue7;33 private String conditionValue8;34 private String conditionValue9;35 private String conditionValue10;36 private String conditionValue11;37 private String conditionValue12;38 private String conditionValue13;39 private String conditionValue14;40 private String conditionValue15;41 private String conditionValue16;42 private String conditionValue17;43 private String conditionValue18;44 private String conditionValue19;45 private String conditionValue20;46 private String returnCode;47 private String returnMessage;48 private String returnCodeConditionOperator;49 private String returnCodeConditionVal1Init;50 private String returnCodeConditionVal2Init;51 private String returnCodeConditionVal1;52 private String returnCodeConditionVal2;53 private String returnCodeConditionVal1Options;54 private String returnCodeConditionVal2Options;55 private String returnCodeConditionOptions;56 private String returnCodeConditionDatabase;57 private String returnCodeConditionValue1;58 private String returnCodeConditionValue2;59 private String returnCodeConditionValue3;60 private String returnCodeConditionValue4;61 private String returnCodeConditionValue5;62 private String returnCodeConditionValue6;63 private String returnCodeConditionValue7;64 private String returnCodeConditionValue8;65 private String returnCodeConditionValue9;66 private String returnCodeConditionValue10;

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import org.cerberus.crud.entity.TestCaseStepExecution;3import org.cerberus.crud.entity.TestCaseStepExecution;4public class TestCaseStepExecutionGetConditionOperator {5 public static void main(String[] args) {6 TestCaseStepExecution tcs = new TestCaseStepExecution();7 tcs.setConditionOperator("AND");8 System.out.println(tcs.getConditionOperator());9 }10}11package org.cerberus.crud.entity;12import org.cerberus.crud.entity.TestCaseStepExecution;13import org.cerberus.crud.entity.TestCaseStepExecution;14public class TestCaseStepExecutionGetConditionOperator {15 public static void main(String[] args) {16 TestCaseStepExecution tcs = new TestCaseStepExecution();17 tcs.setConditionOperator("OR");18 System.out.println(tcs.getConditionOperator());19 }20}21package org.cerberus.crud.entity;22import org.cerberus.crud.entity.TestCaseStepExecution;23import org.cerberus.crud.entity.TestCaseStepExecution;24public class TestCaseStepExecutionGetConditionOperator {25 public static void main(String[] args) {26 TestCaseStepExecution tcs = new TestCaseStepExecution();27 tcs.setConditionOperator("AND");28 System.out.println(tcs.getConditionOperator());29 tcs.setConditionOperator("OR");30 System.out.println(tcs.getConditionOperator());31 }32}33package org.cerberus.crud.entity;34import org.cerber

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import java.util.logging.Logger;3public class TestCaseStepExecution{4 private static final Logger LOG = Logger.getLogger(TestCaseStepExecution.class.getName());5 public static void main(String[] args) {6 TestCaseStepExecution testCaseStepExecution = new TestCaseStepExecution();7 testCaseStepExecution.getConditionOperator();8 }9}10package org.cerberus.crud.entity;11import java.util.logging.Logger;12public class TestCaseStepExecution{13 private static final Logger LOG = Logger.getLogger(TestCaseStepExecution.class.getName());14 public static void main(String[] args) {15 TestCaseStepExecution testCaseStepExecution = new TestCaseStepExecution();16 testCaseStepExecution.getConditionOperator1();17 }18}19package org.cerberus.crud.entity;20import java.util.logging.Logger;21public class TestCaseStepExecution{22 private static final Logger LOG = Logger.getLogger(TestCaseStepExecution.class.getName());23 public static void main(String[] args) {24 TestCaseStepExecution testCaseStepExecution = new TestCaseStepExecution();25 testCaseStepExecution.getConditionOperator2();26 }27}28package org.cerberus.crud.entity;29import java.util.logging.Logger;30public class TestCaseStepExecution{31 private static final Logger LOG = Logger.getLogger(TestCaseStepExecution.class.getName());32 public static void main(String[] args) {33 TestCaseStepExecution testCaseStepExecution = new TestCaseStepExecution();34 testCaseStepExecution.getConditionOperator3();35 }36}37package org.cerberus.crud.entity;38import java.util.logging.Logger;39public class TestCaseStepExecution{40 private static final Logger LOG = Logger.getLogger(TestCaseStepExecution.class.getName());41 public static void main(String[] args) {42 TestCaseStepExecution testCaseStepExecution = new TestCaseStepExecution();43 testCaseStepExecution.getConditionOperator4();44 }45}

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2public class TestCaseStepExecution {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 TestCaseStepExecution {13 private String test;14 public String getTest() {15 return test;16 }17 public void setTest(String test) {18 this.test = test;19 }20}21package org.cerberus.crud.entity;22public class TestCaseStepExecution {23 private String testCase;24 public String getTestCase() {25 return testCase;26 }27 public void setTestCase(String testCase) {28 this.testCase = testCase;29 }30}31package org.cerberus.crud.entity;32public class TestCaseStepExecution {33 private int step;34 public int getStep() {35 return step;36 }37 public void setStep(int step) {38 this.step = step;39 }40}41package org.cerberus.crud.entity;42public class TestCaseStepExecution {43 private int sort;44 public int getSort() {45 return sort;46 }47 public void setSort(int sort) {48 this.sort = sort;49 }50}51package org.cerberus.crud.entity;52public class TestCaseStepExecution {53 private String loop;54 public String getLoop() {55 return loop;56 }

Full Screen

Full Screen

getConditionOperator

Using AI Code Generation

copy

Full Screen

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

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