1.1 --- a/testng/src/org/netbeans/modules/contrib/testng/output/TestNGOutputReader.java Fri Dec 23 16:41:31 2011 +0100
1.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/output/TestNGOutputReader.java Fri Dec 23 17:06:52 2011 +0100
1.3 @@ -234,17 +234,16 @@
1.4 }
1.5 //test
1.6 if (in.startsWith("INVOKING: ")) {
1.7 + if (txt.size() > 0) {
1.8 + addStackTrace(txt);
1.9 + txt.clear();
1.10 + }
1.11 Matcher m = Pattern.compile(RegexpUtils.TEST_REGEX).matcher(in);
1.12 if (m.matches()) {
1.13 testStarted(m.group(1), m.group(2), m.group(4), m.group(6));
1.14 } else {
1.15 assert false : "Cannot match: '" + in + "'.";
1.16 }
1.17 - if (txt.size() > 0) {
1.18 - addStackTrace(txt);
1.19 - txt.clear();
1.20 - }
1.21 - last = null;
1.22 return;
1.23 }
1.24
1.25 @@ -289,13 +288,7 @@
1.26 }
1.27
1.28 Matcher m1 = Pattern.compile(RegexpUtils.RUNNING_SUITE_REGEX).matcher(in);
1.29 - if ((m.matches() || m1.matches()) && last != null) {
1.30 - //update last testcase with the stacktrace
1.31 - if (txt.size() > 0) {
1.32 - addStackTrace(txt);
1.33 - txt.clear();
1.34 - }
1.35 - } else {
1.36 + if (!(m.matches() || m1.matches())) {
1.37 if (txt.isEmpty() && in.startsWith(" ")) {
1.38 //we received test description
1.39 addDescription(in.trim());
1.40 @@ -311,6 +304,10 @@
1.41 if (msg == null) {
1.42 return;
1.43 }
1.44 + Testcase tc = testSession.getCurrentTestCase();
1.45 + if (tc != null) {
1.46 + tc.getOutput().add(new OutputLine(msg, false));
1.47 + }
1.48 if (!expectXmlReport) {
1.49 //log/verbose level = 0 so don't show output
1.50 displayOutput(msg, event.getLogLevel() == AntEvent.LOG_WARN);
1.51 @@ -658,8 +655,6 @@
1.52 }
1.53 }
1.54
1.55 - private TestNGTestcase last = null;
1.56 -
1.57 private void testFinished(String st, String suiteName, String testCase, String parameters, String values, String duration) {
1.58 testSession.setCurrentSuite(suiteName);
1.59 TestNGTestcase tc = ((TestNGTestSuite) ((TestNGTestSession) testSession).getCurrentSuite()).getTestCase(testCase, values);
1.60 @@ -686,7 +681,6 @@
1.61 Report r = reports.get(suiteName);
1.62 r.update(testSession.getReport(dur));
1.63 manager.displayReport(testSession, r, false);
1.64 - last = tc;
1.65 }
1.66
1.67 private String getMessage(String msg) {
1.68 @@ -695,12 +689,12 @@
1.69 }
1.70
1.71 private void addDescription(String in) {
1.72 - last.setDescription(in);
1.73 + ((TestNGTestcase) testSession.getCurrentTestCase()).setDescription(in);
1.74 }
1.75
1.76 private void addStackTrace(List<String> txt) {
1.77 Trouble t = new Trouble(false);
1.78 t.setStackTrace(txt.toArray(new String[txt.size()]));
1.79 - last.setTrouble(t);
1.80 + testSession.getCurrentTestCase().setTrouble(t);
1.81 }
1.82 }