Package fit

Examples of fit.Parse


      }
    }

    public void exception(Throwable e)
    {
      Parse cell = cells.get(0);
      cell.addToBody("<hr/>" + label(e.toString()));
      cell.addToTag(" class=\"error\"");
    }
View Full Code Here


import fit.Parse;

public class ParserTest extends TestCase {

    public void testCanParseTablesToRetrieveNameOfFixture() throws Exception {
        Parse tables = new Parse(read(getReader("jbehave/fit/Fit.html")),
                new String[] { "html", "body", "table", "tr", "td" });
        Parse parts = tables.parts;
        Parse leaf = parts.leaf();
        StringWriter writer = new StringWriter();
        leaf.print(new PrintWriter(writer));
        assertTrue(writer.getBuffer().toString().trim().indexOf(TestFixture.class.getName()) > -1);
    }
View Full Code Here

    String[][] data = new String[rows][];
    parameters.put("data", data);
   
    for (int row = 0; row < rows; row++) {
      List<String> rowData = new ArrayList<String>();
      Parse newCell = null;
      Parse oldCell = null;
      for (int col = 0; col < 5; col++) {
        newCell = getCell(row, col);
        if (newCell != oldCell) {
          oldCell = newCell;
          rowData.add(newCell.text());
View Full Code Here

    testRunner.addTestBundle(bundleSymbolicName, versionRange);
  }


  private void addTestResultRows(Parse cells, List<OSGiTestResult> testResults) {
    Parse last = cells.last();
    last.more = buildHeaderRow();
    last = cells.last();
    last.more = buildRows(testResults);
  }
View Full Code Here

    last = cells.last();
    last.more = buildRows(testResults);
  }

  private Parse buildHeaderRow() {
    Parse root = new Parse(null, null, null, null);
    Parse first = new Parse("td", "Status", null, null);
    Parse next = first.more = new Parse("td", "Test Name", null, null);
    next = next.more = new Parse("td", "Description", null, null);
    next = next.more = new Parse("td", "Message", null, null);
    root.more = new Parse("tr", null, first, null);
    return root.more;
  }
View Full Code Here

    root.more = new Parse("tr", null, first, null);
    return root.more;
  }
 
  private Parse buildRows(List<OSGiTestResult> testResults) {
    Parse root = new Parse(null, null, null, null);
    Parse next = root;
    for (int i = 0; i < testResults.size(); i++) {
      next = next.more = new Parse("tr", null, buildCells(testResults.get(i)), null);
    }
    return root.more;
  }
View Full Code Here

    }
    return root.more;
  }

  private Parse buildCells(OSGiTestResult testResult) {
    Parse root = new Parse(null, null, null, null);
    Parse next = root;
    if (testResult.isInfo()) {
      next = next.more = new Parse("td", "Test Case", null, null);
      next = next.more = new Parse("td", escape(testResult.getMessage()), null, null);
      next = next.more = new Parse("td", escape(testResult.getDescription()), null, null);
      next = next.more = new Parse("td", "&nbsp;", null, null);
    } else {
      if (testResult.hasPassed()) {
        next = next.more = new Parse("td", "Pass", null, null);
        right(next);
      } else if (testResult.hasFailed()) {
        next = next.more = new Parse("td", "Fail", null, null);
        wrong(next);
      } else if (testResult.hasErrored()) {
        next = next.more = new Parse("td", "Error", null, null);
        exception(next, testResult.getThrowable());
      }
      String testName = testResult.getMethodName();
      next = next.more = new Parse("td", testName, null, null);
      if (testResult.getDescription().equals("")) {
        next = next.more = new Parse("td", "&nbsp;", null, null);
      } else {
        next = next.more = new Parse("td", escape(testResult.getDescription()), null, null);
      }
      if (!testResult.hasPassed()) {
        next = next.more = new Parse("td", escape(testResult.getMessage()), null, null);
      } else {
        next = next.more = new Parse("td", "&nbsp;", null, null);
      }
    }
    return root.more;
  }
View Full Code Here

      throw new RuntimeException("Cannot find bundle " + bundleName);
    }
  }

  private void addTestResultRows(Parse cells, List<OSGiTestResult> testResults) {
    Parse last = cells.last();
    last.more = buildHeaderRow();
    last = cells.last();
    last.more = buildRows(testResults);
  }
View Full Code Here

    last = cells.last();
    last.more = buildRows(testResults);
  }

  private Parse buildHeaderRow() {
    Parse root = new Parse(null, null, null, null);
    Parse first = new Parse("td", "Status", null, null);
    Parse next = first.more = new Parse("td", "Test Name", null, null);
    next = next.more = new Parse("td", "Message", null, null);
    root.more = new Parse("tr", null, first, null);
    return root.more;
  }
View Full Code Here

    root.more = new Parse("tr", null, first, null);
    return root.more;
  }
 
  private Parse buildRows(List<OSGiTestResult> testResults) {
    Parse root = new Parse(null, null, null, null);
    Parse next = root;
    for (int i = 0; i < testResults.size(); i++) {
      next = next.more = new Parse("tr", null, buildCells(testResults.get(i)), null);
    }
    return root.more;
  }
View Full Code Here

TOP

Related Classes of fit.Parse

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.