view diff action
authorLukas Jungmann <jungi@netbeans.org>
Fri, 23 Dec 2011 21:33:51 +0100
changeset 17713affecd534f69
parent 17712 1e6ee6cb22b7
child 17714 35f7ce4ebcb7
view diff action
testng/src/org/netbeans/modules/contrib/testng/output/TestNGOutputReader.java
     1.1 --- a/testng/src/org/netbeans/modules/contrib/testng/output/TestNGOutputReader.java	Fri Dec 23 17:06:52 2011 +0100
     1.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/output/TestNGOutputReader.java	Fri Dec 23 21:33:51 2011 +0100
     1.3 @@ -136,7 +136,9 @@
     1.4          reports = new HashMap<String, Report>();
     1.5      }
     1.6  
     1.7 -    /** for tests */
     1.8 +    /**
     1.9 +     * for tests
    1.10 +     */
    1.11      TestNGOutputReader(TestNGTestSession session) {
    1.12          testSession = session;
    1.13          sessionType = session.getSessionType();
    1.14 @@ -146,7 +148,6 @@
    1.15          reports = new HashMap<String, Report>();
    1.16      }
    1.17  
    1.18 -
    1.19      Project getProject() {
    1.20          return project;
    1.21      }
    1.22 @@ -280,10 +281,10 @@
    1.23  
    1.24          //configuration methods
    1.25          if (in.contains(" CONFIGURATION: ")) {
    1.26 -            if (txt.size() > 0) {
    1.27 -                addStackTrace(txt);
    1.28 -                txt.clear();
    1.29 -            }
    1.30 +//            if (txt.size() > 0) {
    1.31 +//                addStackTrace(txt);
    1.32 +//                txt.clear();
    1.33 +//            }
    1.34              return;
    1.35          }
    1.36  
    1.37 @@ -292,7 +293,7 @@
    1.38              if (txt.isEmpty() && in.startsWith("       ")) {
    1.39                  //we received test description
    1.40                  addDescription(in.trim());
    1.41 -            } else {
    1.42 +            } else if (in.trim().length() > 0) {
    1.43                  //we have a stacktrace
    1.44                  txt.add(in);
    1.45              }
    1.46 @@ -689,11 +690,31 @@
    1.47      }
    1.48  
    1.49      private void addDescription(String in) {
    1.50 -        ((TestNGTestcase) testSession.getCurrentTestCase()).setDescription(in);
    1.51 +        Testcase tc = testSession.getCurrentTestCase();
    1.52 +        //FIXME!!! tc should never be null
    1.53 +        //looks like some bug :-(
    1.54 +        if (tc != null) {
    1.55 +            ((TestNGTestcase) tc).setDescription(in);
    1.56 +        }
    1.57      }
    1.58  
    1.59      private void addStackTrace(List<String> txt) {
    1.60          Trouble t = new Trouble(false);
    1.61 +        Matcher matcher = RegexpUtils.getInstance().getComparisonPattern().matcher(txt.get(0));
    1.62 +        if (matcher.matches()) {
    1.63 +            t.setComparisonFailure(
    1.64 +                    new Trouble.ComparisonFailure(
    1.65 +                    matcher.group(1) + matcher.group(2) + matcher.group(3),
    1.66 +                    matcher.group(4) + matcher.group(5) + matcher.group(6)));
    1.67 +        } else {
    1.68 +            matcher = RegexpUtils.getInstance().getComparisonHiddenPattern().matcher(txt.get(0));
    1.69 +            if (matcher.matches()) {
    1.70 +                t.setComparisonFailure(
    1.71 +                        new Trouble.ComparisonFailure(
    1.72 +                        matcher.group(1),
    1.73 +                        matcher.group(2)));
    1.74 +            }
    1.75 +        }
    1.76          t.setStackTrace(txt.toArray(new String[txt.size()]));
    1.77          testSession.getCurrentTestCase().setTrouble(t);
    1.78      }