Package com.google.eclipse.javascript.jstestdriver.core.model

Examples of com.google.eclipse.javascript.jstestdriver.core.model.ResultModel


    assertEquals(3, model.getNumberOfFailures());
    assertEquals(2, model.getNumberOfErrors());
  }
 
  public void testAddTestResultTestCase() throws Exception {
    ResultModel model = new EclipseJstdBrowserRunResult(null, "browser");

    model.addTestResult(passing1);
    model.addTestResult(failed1);
    model.addTestResult(error1);
    model.addTestResult(passing2);
    model.addTestResult(failed2);
    model.addTestResult(failed3);
    model.addTestResult(error2);
   
    assertEquals(2, model.getChildren().size());
    Iterator<? extends ResultModel> iterator = model.getChildren().iterator();
    ResultModel testcase1 = iterator.next();
    ResultModel testcase2 = iterator.next();
   
    assertEquals("testcase1 (10.0 ms)", testcase1.getDisplayLabel());
    assertEquals(3, testcase1.getNumberOfTests());
    assertEquals(1, testcase1.getNumberOfErrors());
    assertEquals(1, testcase1.getNumberOfFailures());

    assertEquals("testcase (18.0 ms)", testcase2.getDisplayLabel());
    assertEquals(4, testcase2.getNumberOfTests());
    assertEquals(1, testcase2.getNumberOfErrors());
    assertEquals(2, testcase2.getNumberOfFailures());
  }
View Full Code Here


*/
public class FailureOnlyViewerFilter extends ViewerFilter {

  @Override
  public boolean select(Viewer viewer, Object parentElement, Object element) {
    ResultModel model = (ResultModel) element;
    return !model.passed();
  }
View Full Code Here

  TestResult error1 = new TestResult(null, "error", "", "", "testcase2", "test6", 0f);
  TestResult error2 = new TestResult(null, "error", "", "", "testcase", "test7", 0f);

  public void testSelect() throws Exception {
    ViewerFilter filter = new FailureOnlyViewerFilter();
    ResultModel model = new EclipseJstdBrowserRunResult(null, "browser");

    model.addTestResult(passing1);
    model.addTestResult(passing2);
    model.addTestResult(failed1);
    model.addTestResult(failed2);
    model.addTestResult(error1);
    model.addTestResult(error2);

    Iterator<? extends ResultModel> iterator = model.getChildren().iterator();
    ResultModel testcase1 = iterator.next();
    ResultModel testcase3 = iterator.next();
    ResultModel testcase2 = iterator.next();
   
    assertTrue(filter.select(null, null, model));
    assertTrue(filter.select(null, null, testcase1));
    assertTrue(filter.select(null, null, testcase2));
    assertFalse(filter.select(null, null, testcase3));
   
    assertTrue(filter.select(null, null, testcase1.getChildren().iterator().next()));
   
    iterator = testcase2.getChildren().iterator();
    assertTrue(filter.select(null, null, iterator.next()));
    assertTrue(filter.select(null, null, iterator.next()));
    assertFalse(filter.select(null, null, iterator.next()));
   
    assertFalse(filter.select(null, null, testcase3.getChildren().iterator().next()));
View Full Code Here

   */
  public void addTestResults(Collection<TestResult> testResults) {
    synchronized (this) {
      Collection<ResultModel> failedTests = Lists.newArrayList();
      for (TestResult result : testResults) {
        ResultModel addedResult = testRunResult.addTestResult(result);
        messageConsoleStream.println(result.getLog());
        if (!addedResult.passed()) {
          failedTests.add(addedResult);
        }
      }
      try {
        messageConsoleStream.flush();
View Full Code Here

  }

  @Override
  public Image getImage(Object obj) {
    if (obj instanceof ResultModel) {
      ResultModel resultModel = (ResultModel) obj;
      return icons.getImage(resultModel.getDisplayImagePath());
    }
    return null;
  }
View Full Code Here

  TestResult failed3 = new TestResult(null, "failed", "", "", "testcase", "test5", 5f);
  TestResult error1 = new TestResult(null, "error", "", "", "testcase1", "test6", 6f);
  TestResult error2 = new TestResult(null, "error", "", "", "testcase", "test7", 7f);

  public void testDidPass() throws Exception {
    ResultModel model = new EclipseJstdTestCaseResult(null, "testcase");
   
    assertTrue(model.passed());
    model.addTestResult(passing1);
    assertTrue(model.passed());
    model.addTestResult(passing2);
    assertTrue(model.passed());
    model.addTestResult(failed1);
    assertFalse(model.passed());
    model.addTestResult(failed2);
    assertFalse(model.passed());
  }
View Full Code Here

    model.addTestResult(failed2);
    assertFalse(model.passed());
  }
 
  public void testHasChildren() throws Exception {
    ResultModel model = new EclipseJstdTestCaseResult(null, "testcase");
   
    assertFalse(model.hasChildren());
    model.addTestResult(passing1);
    assertTrue(model.hasChildren());
    model.addTestResult(failed1);
    assertTrue(model.hasChildren());
  }
View Full Code Here

    model.addTestResult(failed1);
    assertTrue(model.hasChildren());
  }
 
  public void testGetNumbers() throws Exception {
    ResultModel model = new EclipseJstdBrowserRunResult(null, "browser");
   
    assertEquals(0, model.getNumberOfTests());
    assertEquals(0, model.getNumberOfFailures());
    assertEquals(0, model.getNumberOfErrors());
   
    model.addTestResult(passing1);
    model.addTestResult(failed1);
    model.addTestResult(error1);

    assertEquals(3, model.getNumberOfTests());
    assertEquals(1, model.getNumberOfFailures());
    assertEquals(1, model.getNumberOfErrors());

    model.addTestResult(passing2);
    model.addTestResult(failed2);
    model.addTestResult(failed3);
    model.addTestResult(error2);
   
    assertEquals(7, model.getNumberOfTests());
    assertEquals(3, model.getNumberOfFailures());
    assertEquals(2, model.getNumberOfErrors());
  }
View Full Code Here

TOP

Related Classes of com.google.eclipse.javascript.jstestdriver.core.model.ResultModel

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.