public DiffViewAction(Testcase testcase) { this(testcase.getTrouble() != null ? testcase.getTrouble().getComparisonFailure() : null); }
@Override @NbBundle.Messages("LBL_CopyStackTrace=&Copy Stack Trace") public Action[] getActions(boolean context) { List<Action> actions = new ArrayList<Action>(); if ((testcase.getTrouble() != null) && (testcase.getTrouble().getComparisonFailure() != null)){ actions.add(new DiffViewAction(testcase)); } if (testcase.getTrouble() != null && testcase.getTrouble().getStackTrace() != null) { StringBuilder callStack = new StringBuilder(); for(String stack : testcase.getTrouble().getStackTrace()) { if(stack != null) { callStack.append(stack.concat("\n")); } } if (callStack.length() > 0) { final String trace = callStack.toString(); actions.add(new AbstractAction(Bundle.LBL_CopyStackTrace()) { @Override public void actionPerformed(ActionEvent e) { Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(trace), null); } }); } } return actions.toArray(new Action[actions.size()]); }
if (INLINE_RESULTS && testcase.getTrouble() != null && testcase.getTrouble().getStackTrace() != null && testcase.getTrouble().getStackTrace().length > 0) { try { cause = XMLUtil.toElementContent(testcase.getTrouble().getStackTrace()[0]).replace("\n", " "); // NOI18N } catch (CharConversionException ex) {
private void addStackTraceLine(Testcase testcase, String line, boolean validateST){ Trouble trouble = testcase.getTrouble(); if ((trouble == null) || (line == null) || (line.length() == 0) || (line.equals("null"))){ //NOI18N return; List<String> stList = new ArrayList(Arrays.asList(testcase.getTrouble().getStackTrace())); if (!line.startsWith(stList.get(stList.size()-1))){ stList.add(line);
protected TestMethodNode(final Testcase testcase, Project project, Lookup lookup) { super(testcase.getTrouble() != null ? new TestMethodNodeChildren(testcase) : Children.LEAF, lookup); this.testcase = testcase; this.project = new WeakReference<Project>(project); this.projectURI = project.getProjectDirectory().toURI(); setDisplayName(); if (TestsuiteNode.DISPLAY_TOOLTIPS) { setShortDescription(TestsuiteNode.toTooltipText(testcase.getOutput())); } }
if (methodNode.getTestcase().getTrouble() != null) { String[] st = methodNode.getTestcase().getTrouble().getStackTrace(); if (st != null) { stack.append("\n"); FileObject file = getFile(frameInfo, lineNumStorage, locator); if (testfo != null && file == null && methodNode.getTestcase().getTrouble() != null && lineNumStorage[0] == -1) { String[] st = methodNode.getTestcase().getTrouble().getStackTrace(); if ((st != null) && (st.length > 0)) { int index = st.length - 1;
@Override public void run() { if (node instanceof TestsuiteNode) { UIJavaUtils.openTestsuite((TestsuiteNode) node, projectType, testingFramework); } else if (node instanceof CallstackFrameNode) { UIJavaUtils.openCallstackFrame(node, callstackFrameInfo, projectType, testingFramework); } else if (node instanceof TestMethodNode) { if (((TestMethodNode) node).getTestcase().getTrouble() != null) { // method failed, find failing line within the testMethod using the stacktrace UIJavaUtils.openCallstackFrame(node, "", projectType, testingFramework); } else { UIJavaUtils.openTestMethod((TestMethodNode) node, projectType, testingFramework); } } } });
@Override public void run() { if (node instanceof TestsuiteNode) { OutputUtils.openTestsuite((TestsuiteNode) node); } else if (node instanceof JUnitCallstackFrameNode) { OutputUtils.openCallstackFrame(node, callstackFrameInfo); } else if (node instanceof JUnitTestMethodNode) { if (((JUnitTestMethodNode) node).getTestcase().getTrouble() != null) { // method failed, find failing line within the testMethod using the stacktrace OutputUtils.openCallstackFrame(node, ""); } else { OutputUtils.openTestMethod((JUnitTestMethodNode) node); } } } });
/** */ @Override protected void addNotify() { Trouble trouble = testcase.getTrouble(); int stackTraceLength = trouble.getStackTrace() != null ? trouble.getStackTrace().length : 0; Node[] children = new Node[stackTraceLength]; TestRunnerNodeFactory nodeFactory = Manager.getInstance().getNodeFactory(); for (int i = 0; i < stackTraceLength; i++) { if (i == 0 && stackTraceLength >= 2) { children[i] = nodeFactory.createCallstackFrameNode(trouble.getStackTrace()[1], trouble.getStackTrace()[0]); } else { children[i] = nodeFactory.createCallstackFrameNode(trouble.getStackTrace()[i], null); } } add(children); } }
"# {0} - name of the test method", "# {1} - elapsed time in seconds", "MSG_TestMethodError_time={0} - caused an ERROR ({1,number,0.0##} s)"}) private void setDisplayName() { final int status = (testcase.getTrouble() == null) ? 0 : testcase.getTrouble().isError() ? 1 : 2;