Package com.qspin.qtaste.reporter.testresults

Examples of com.qspin.qtaste.reporter.testresults.TestResult


                        if (testSuite != null) {
                            testSuite.reportTestRetry();
                        }
                    }

                    TestResult testResult = initTestResult(data, requirements, trial, reportManager, ds.getData().indexOf(data), ds.getData().size());
                    testResults.add(testResult);

                    int timeout = DEFAULT_TIMEOUT;
                    if (debug) {
                        logger.info("Not using test timeout because running in debug mode");                     
                    } else {
                      try {
                          timeout = data.getIntValue("TIMEOUT");
                          logger.info("Using test timeout of " + timeout + " seconds");
                          timeout = timeout * 1000;
                      } catch (QTasteDataException e) {
                          if (e.getMessage().contains("doesn't contain")) {
                              logger.info("No TIMEOUT test data, using default test timeout (" + DEFAULT_TIMEOUT / 1000 + " seconds)");
                          } else {
                              logger.error(e.getMessage() + ". Using default test timeout (" + DEFAULT_TIMEOUT / 1000 + " seconds)");
                          }
                      }
                    }

                    TaskThread taskThread = new TaskThread(debug, data, testResult, timeout);

                    // clear cache history
                    CacheImpl.getInstance().clearHistory();

                    // initialize instantiated components
                    testAPI.initializeComponents();

                    testResult.start();

                    // wait till the end of the Task or Timeout
                    reportManager.putEntry(testResult);

                    taskThread.start();
                    boolean taskThreadTerminated = taskThread.waitForEnd();

                    reportManager.refresh();

                    // terminate instantiated components
                    testAPI.terminateComponents();

                    // exit QTaste if test thread couldn't be stopped, because we are in an unstable state
                    if (!taskThreadTerminated) {
                        JOptionPane.showMessageDialog(null, "Couldn't stop test thread!\nQTaste will now exit because system state is unstable.", "Fatal error", JOptionPane.ERROR_MESSAGE);
                        TestEngine.shutdown();
                        System.exit(1);
                    }

                    status = testResult.getStatus();
                    if (status != TestResult.Status.SUCCESS)
                    {
                        if (status == TestResult.Status.FAIL) {
                           needToRetry = TestEngine.setNeedToRestartSUT();
                        }
View Full Code Here


        }
        if (testCaseName.equals("QTaste_interactive")) {
          testCaseName = name;
        }

        TestResult result = new TestResultImpl(testCaseName, data, requirements, currentRowIndex, numberRows);
        result.setTestCaseDirectory(testCaseDirectory);
        result.setTestScriptVersion(version);

        // TODO: What's this???
        //if (reporter != null) {
        //    result.setReportManager(reporter);
        //}
        try {
            result.setComment(data.getValue("COMMENT"));
        } catch (QTasteException e) {
        }

        result.setRetryCount(retryCount);

        return result;
    }
View Full Code Here

                l.add(data.getDataHash());
                // checks must be added to ask specific data
                JythonTestScript ts = new JythonTestScript(l, requirements, iQTasteFile, iQTasteDirectory, null);
                ts.setName(tcId);
                ts.execute(false);
                TestResult testResult = ts.getTestResults().get(0);
                testResult.setName(tcId);
                testResult.setComment("");
                Bindings globalContext = JythonTestScript.getEngine().getBindings(ScriptContext.ENGINE_SCOPE);
                if (globalContext.containsKey("result")) {
                    Object returnObject = globalContext.get("result");
                    String returnValue = "None";
                    if (returnObject != null) {
                        returnValue = returnObject.toString();
                    }
                    if (!ts.getTestDataSet().getData().isEmpty()) {
                        testResult.setReturnValue(returnValue);
                    }
                }
            } catch (IOException ex) {
                //
            } finally {
View Full Code Here

    }

    protected void updateRunningTestCaseElapsedTime() {
        int lastRow = tcModel.getRowCount() - 1;
        if (lastRow >= 0) {
            TestResult tr = (TestResult) tcModel.getValueAt(lastRow, TC);
            if (tr.getStatus() == TestResult.Status.RUNNING) {
                tcModel.setValueAt(tr.getFormattedElapsedTime(true), lastRow, EXEC_TIME);
            }
        }
    }
View Full Code Here

         */
        public void valueChanged(ListSelectionEvent e) {
            clearReasonTable();
            int selectedRow = tcTable.getSelectedRow();
            if (selectedRow > -1) {
                TestResult tr = (TestResult) tcTable.getModel().getValueAt(selectedRow, TestCaseReportTable.TC);
                if (tr.getStatus() == TestResult.Status.NOT_AVAILABLE ||
                        tr.getStatus() == TestResult.Status.FAIL) {
                    if (tcReasonModel != null) {
                        ArrayList<StackTraceElement> stack = tr.getStack();
                        Iterator<StackTraceElement> it = stack.iterator();
                        while (it.hasNext()) {
                            StackTraceElement stackElement = it.next();
                            if (stackElement.getFileName().equals("embedded_jython")) {
                              continue;
                            }
                            Object[] row = new Object[6];
                            row[LINE] = stackElement.getLineNumber();
                            row[FILE_NAME] = stackElement.getFileName();
                            String methodName = stackElement.getMethodName();
                            if (methodName.equals("f$0")) {
                                methodName = "main";
                            } else {
                                // remove $i suffix from method name
                                int dollarIndex = methodName.indexOf("$");
                                if (dollarIndex > 0) {
                                    methodName = methodName.substring(0, dollarIndex);
                                }
                            }
                            row[TCResultsSelectionListeners.FUNCTION_ID] = methodName;

                            //row[ERR_MSG] = tr.getExtraResultDetails();
                            row[OBJECT] = stackElement;
                            //row[ROW] = tr.getTestData() != null ? tr.getTestData().getRowId() : null;;
                            tcReasonModel.addRow(row);
                        }
                    }
                    if (stackTrace != null) {
                        stackTrace.setText(tr.getStackTrace());
                    }
                }
                tcPane.getResultsLog4jPanel().selectAndScrollToTestCase(tr);
            }
        }
View Full Code Here

      // get the current testbed
      TestBedConfiguration testbed = TestBedConfiguration.getInstance();
      // get the list of failed tests
            CampaignWriter campaign = new CampaignWriter();
            for (int i=0; i < tcTable.getRowCount(); i++) {
                TestResult tr = (TestResult) tcModel.getValueAt(i, TC);
              if (tr.getStatus()== TestResult.Status.FAIL) {
                campaign.addCampaign(testbed.getFile().getName().replace("." + StaticConfiguration.CAMPAIGN_FILE_EXTENSION, ""),
                    tr.getTestCaseDirectory(),
                    tr.getTestData().getRowId());
              }
            }
            // ask for name of test campaign
            String newCampaign = JOptionPane.showInputDialog(null,
                    "Campaign name",
View Full Code Here

        public void actionPerformed(ActionEvent e) {
            int[] selectedRowsId = tcTable.getSelectedRows();
            final LinkedHashMap<String, SortedSet<Integer>> testScripts = new LinkedHashMap<String, SortedSet<Integer>>();
            // group test cases by test script
            for (int rowId : selectedRowsId) {
                TestResult tr = (TestResult) tcModel.getValueAt(rowId, TC);
                SortedSet<Integer> dataRows;
                String testCaseDirectory = tr.getTestCaseDirectory();
                if (testScripts.containsKey(testCaseDirectory)) {
                    dataRows = testScripts.get(testCaseDirectory);
                } else {
                    dataRows = new TreeSet<Integer>();
                    testScripts.put(testCaseDirectory, dataRows);
                }
                dataRows.add(tr.getTestData().getRowId());
            }
            // build meta test suite
            List<TestSuiteParams> testSuitesParams = new LinkedList<TestSuiteParams>();
            for (Map.Entry<String, SortedSet<Integer>> testCases : testScripts.entrySet()) {
                TestSuiteParams testSuiteParams = new TestSuiteParams();
View Full Code Here

                return false;
            } else {
                boolean enabled = false;
                int[] selectedRowsId = tcTable.getSelectedRows();
                for (int rowId : selectedRowsId) {
                    TestResult tr = (TestResult) tcModel.getValueAt(rowId, TC);
                    if (tr.getTestData() != null) {
                        enabled = true;
                    }
                }
                return enabled;
            }
View Full Code Here

  }

  public static boolean restartSUT() {
    if (useControlScript()) {
      logger.info("Restarting SUT");
      TestResult tr = new TestResultImpl("Restart SUT", null, null, 1, 1);
      tr.setTestScriptVersion("-");
      tr.start();
      TestResultsReportManager reportManager = TestResultsReportManager.getInstance();
      reportManager.putEntry(tr);
      isRestartingSUT = true;
      boolean returnValue = stopSUT(tr) && startSUT(tr);
      isRestartingSUT = false;
      tr.stop();
      reportManager.refresh();
      // reportManager.stopReport();
      return returnValue;
    } else {
      return false;
View Full Code Here

  public static boolean initialize() {
    if (useControlScript()) {
      isStartStopSUTCancellable = true;
      isStartStopSUTCancelled = false;

      TestResult tr = new TestResultImpl("Start SUT", null, null, 1, 1);
      tr.setTestScriptVersion("-");
      tr.start();
      TestResultsReportManager reportManager = TestResultsReportManager.getInstance();
      reportManager.putEntry(tr);
      stopSUT(null);
      boolean success = startSUT(tr);
      tr.stop();
      reportManager.refresh();
      if (!success) {
        return false;
      }
    }
View Full Code Here

TOP

Related Classes of com.qspin.qtaste.reporter.testresults.TestResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.