How to use stopTestCase method of org.cerberus.engine.execution.impl.ExecutionRunService class

Best Cerberus-source code snippet using org.cerberus.engine.execution.impl.ExecutionRunService.stopTestCase

Source:ExecutionRunService.java Github

copy

Full Screen

...592 /**593 * We stop the server session here (selenium for ex.).594 */595 try {596 tCExecution = this.stopTestCase(tCExecution);597 } catch (Exception ex) {598 LOG.error(logPrefix + "Exception Stopping Test " + tCExecution.getId() + " Exception :" + ex.toString());599 }600 /**601 * Log Execution602 */603 LOG.info(tCExecution.toJson(false));604 /**605 * Clean memory606 */607 try {608 executionUUID.removeExecutionUUID(tCExecution.getExecutionUUID());609 LOG.debug("Clean ExecutionUUID");610 } catch (Exception ex) {611 LOG.error("Exception cleaning Memory: " + ex.toString());612 }613 /**614 * Log execution is finished615 */616 LOG.info("Execution Finished : UUID=" + tCExecution.getExecutionUUID()617 + "__ID=" + tCExecution.getId() + "__RC=" + tCExecution.getControlStatus() + "__"618 + "TestName=" + tCExecution.getEnvironment() + "." + tCExecution.getCountry() + "."619 + tCExecution.getBuild() + "." + tCExecution.getRevision() + "." + tCExecution.getTest() + "_"620 + tCExecution.getTestCase() + "_" + tCExecution.getTestCaseObj().getDescription().replace(".", ""));621 /**622 * Updating queue to done status only for execution from queue623 */624 if (tCExecution.getQueueID() != 0) {625 executionQueueService.updateToDone(tCExecution.getQueueID(), "", runID);626 }627 /**628 * Retry management, in case the result is not (OK or NE), we629 * execute the job again reducing the retry to 1.630 */631 if (tCExecution.getNumberOfRetries() > 0632 && !tCExecution.getResultMessage().getCodeString().equals("OK")633 && !tCExecution.getResultMessage().getCodeString().equals("NE")) {634 TestCaseExecutionQueue newExeQueue = new TestCaseExecutionQueue();635 if (tCExecution.getQueueID() > 0) {636 // If QueueId exist, we try to get the original execution queue.637 try {638 newExeQueue = executionQueueService.convert(executionQueueService.readByKey(tCExecution.getQueueID()));639 } catch (Exception e) {640 // Unfortunatly the execution no longuer exist so we pick initial value.641 newExeQueue = tCExecution.getTestCaseExecutionQueue();642 }643 } else {644 // Initial Execution does not come from the queue so we pick the value created at the beginning of the execution.645 newExeQueue = tCExecution.getTestCaseExecutionQueue();646 }647 // Forcing init value for that new queue execution : exeid=0, no debugflag and State = QUEUED648 int newRetry = tCExecution.getNumberOfRetries() - 1;649 newExeQueue.setId(0);650 newExeQueue.setDebugFlag("N");651 if (newRetry <= 0) {652 newExeQueue.setComment("Added from Retry. Last attempt to go.");653 } else {654 newExeQueue.setComment("Added from Retry. Still " + newRetry + " attempt(s) to go.");655 }656 newExeQueue.setState(TestCaseExecutionQueue.State.QUEUED);657 newExeQueue.setRetries(newRetry);658 // Insert execution to the Queue.659 executionQueueService.create(newExeQueue);660 }661 /**662 * After every execution finished, <br>663 * if the execution has a tag that has a campaign associated <br>664 * and no more executions are in the queue, <br>665 * we trigger : <br>666 * 1/ The update of the EndExeQueue of the tag <br>667 * 2/ We notify the Distribution List with execution report status668 */669 try {670 if (!StringUtil.isNullOrEmpty(tCExecution.getTag())) {671 Tag currentTag = tagService.convert(tagService.readByKey(tCExecution.getTag()));672 if ((currentTag != null)) {673 if (currentTag.getDateEndQueue().before(Timestamp.valueOf("1980-01-01 01:01:01.000000001"))) {674 AnswerList answerListQueue = new AnswerList();675 answerListQueue = executionQueueService.readQueueOpen(tCExecution.getTag());676 if (answerListQueue.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode()) && (answerListQueue.getDataList().isEmpty())) {677 LOG.debug("No More executions in (queue) on tag : " + tCExecution.getTag() + " - " + answerListQueue.getDataList().size() + " " + answerListQueue.getMessageCodeString() + " - ");678 tagService.updateDateEndQueue(tCExecution.getTag(), new Timestamp(new Date().getTime()));679 if (!StringUtil.isNullOrEmpty(currentTag.getCampaign())) {680 // We get the campaig here and potencially send the notification.681 emailService.generateAndSendNotifyEndTagExecution(tCExecution.getTag(), currentTag.getCampaign());682 }683 } else {684 LOG.debug("Still executions in queue on tag : " + tCExecution.getTag() + " - " + answerListQueue.getDataList().size() + " " + answerListQueue.getMessageCodeString());685 }686 } else {687 LOG.debug("Tag is already flaged with recent timstamp. " + currentTag.getDateEndQueue());688 }689 }690 }691 } catch (Exception e) {692 LOG.error(e);693 }694 //695 // After every execution finished we try to trigger more from the queue;-).696 executionThreadPoolService.executeNextInQueueAsynchroneously(false);697 }698 return tCExecution;699 }700 @Override701 public TestCaseExecution stopTestCase(TestCaseExecution tCExecution) {702 /**703 * Stop Execution704 */705 LOG.debug(tCExecution.getId() + " - Stop the execution " + tCExecution.getId() + " UUID:" + tCExecution.getExecutionUUID());706 try {707 //TODO:FN debug messages to be removed708 LOG.debug("[DEBUG] STOP " + "__ID=" + tCExecution.getId());709 this.stopRunTestCase(tCExecution);710 } catch (Exception ex) {711 LOG.warn("Exception Stopping Execution " + tCExecution.getId() + " Exception :" + ex.toString());712 }713 /**714 * Collecting and calculating Statistics.715 */...

Full Screen

Full Screen

stopTestCase

Using AI Code Generation

copy

Full Screen

1import org.cerberus.engine.execution.impl.ExecutionRunService;2import org.cerberus.engine.execution.impl.TestCaseExecutionService;3import org.cerberus.engine.execution.impl.TestExecutorService;4import org.cerberus.engine.execution.impl.TestExecutionService;5import org.cerberus.engine.execution.impl.TestSuiteExecutionService;6import org.cerberus.engine.execution.impl.TestSuiteExecutorService;7import org.cerberus.engine.execution.impl.TestSuiteService;8ExecutionRunService executionRunService;9TestCaseExecutionService testCaseExecutionService;10TestExecutorService testExecutorService;11TestExecutionService testExecutionService;12TestSuiteExecutionService testSuiteExecutionService;13TestSuiteExecutorService testSuiteExecutorService;14TestSuiteService testSuiteService;15executionRunService = new ExecutionRunService();16testCaseExecutionService = new TestCaseExecutionService();17testExecutorService = new TestExecutorService();18testExecutionService = new TestExecutionService();19testSuiteExecutionService = new TestSuiteExecutionService();20testSuiteExecutorService = new TestSuiteExecutorService();21testSuiteService = new TestSuiteService();22executionRunService.stopTestCase("TEST", "TESTCASE");23executionRunService.stopTest("TEST");24executionRunService.stopTestSuite("TEST");25testCaseExecutionService.stopTestCaseExecution("TEST", "TESTCASE");26testExecutionService.stopTestExecution("TEST");27testSuiteExecutionService.stopTestSuiteExecution("TEST");28testExecutorService.stopTestCase("TEST", "TESTCASE");29testExecutorService.stopTest("TEST");30testExecutorService.stopTestSuite("TEST");31testSuiteExecutorService.stopTestCase("TEST", "TESTCASE");32testSuiteExecutorService.stopTest("TEST");33testSuiteExecutorService.stopTestSuite("TEST");34testSuiteService.stopTestSuite("TEST");35testSuiteService.stopTestCase("TEST", "TESTCASE");36testSuiteService.stopTest("TEST");37testSuiteService.stopTestCaseExecution("TEST", "TESTCASE");38testSuiteService.stopTestExecution("TEST");

Full Screen

Full Screen

stopTestCase

Using AI Code Generation

copy

Full Screen

1import org.cerberus.engine.execution.impl.ExecutionRunService2import org.cerberus.engine.execution.impl.TestCaseExecution3def tcer = (TestCaseExecution) testContext.get("testCaseExecution")4def executionRunService = tcer.getApplicationContext().getBean(ExecutionRunService.class)5executionRunService.stopTestCase(tcer)6import org.cerberus.engine.execution.impl.ExecutionRunService7import org.cerberus.engine.execution.impl.TestCaseExecution8def tcer = (TestCaseExecution) testContext.get("testCaseExecution")9def executionRunService = tcer.getApplicationContext().getBean(ExecutionRunService.class)10executionRunService.stopTest(tcer)11import org.cerberus.engine.execution.impl.ExecutionRunService12import org.cerberus.engine.execution.impl.TestCaseExecution13def tcer = (TestCaseExecution) testContext.get("testCaseExecution")14def executionRunService = tcer.getApplicationContext().getBean(ExecutionRunService.class)15executionRunService.stopCampaign(tcer)16import org.cerberus.engine.execution.impl.ExecutionRunService17import org.cerberus.engine.execution.impl.TestCaseExecution18def tcer = (TestCaseExecution) testContext.get("testCaseExecution")19def executionRunService = tcer.getApplicationContext().getBean(ExecutionRunService.class)20executionRunService.stopExecution(tcer)21import org.cerberus.engine.execution

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