Package junit.framework

Examples of junit.framework.Test


  public void testNotVoidTestCase() {
    TestSuite suite= new TestSuite(NotVoidTestCase.class);
    assertTrue(suite.countTestCases() == 1);
  }
  public void testOneTestCase() {
    Test t= new TestSuite(OneTestCase.class);
    t.run(fResult);
    assertTrue(fResult.runCount() == 1)
    assertTrue(fResult.failureCount() == 0);
    assertTrue(fResult.errorCount() == 0);
    assertTrue(fResult.wasSuccessful());
  }
View Full Code Here


  }
  public void testExceptionRunningAndTearDown() {
    // With 1.4, we should
    // wrap the exception thrown while running with the exception thrown
    // while tearing down
    Test t= new TornDown() {
      @Override
      public void tearDown() {
        throw new Error("tearingDown");
      }
    };
    TestResult result= new TestResult();
    t.run(result);
    TestFailure failure= result.errors().nextElement();
    assertEquals("running", failure.thrownException().getMessage());
  }
View Full Code Here

      assertSame(running, thrown);
    }
  }
 
  public void testNoArgTestCasePasses() {
    Test t= new TestSuite(NoArgTestCaseTest.class);
    TestResult result= new TestResult();
    t.run(result);
    assertTrue(result.runCount() == 1);
    assertTrue(result.failureCount() == 0);
    assertTrue(result.errorCount() == 0);
  }
View Full Code Here

    public void runTest() {
    }
  }
   
  public void testActiveTest() {   
    Test test= createActiveTestSuite();
    TestResult result= new TestResult();
    test.run(result);
    assertEquals(100, result.runCount());
    assertEquals(0, result.failureCount());
    assertEquals(0, result.errorCount());
  }
View Full Code Here

  public void rerun() {
    int index= fFailureList.getSelectedIndex();
    if (index == -1)
      return;

    Test test= (Test)fFailedTests.elementAt(index);
    rerunTest(test);
  }
View Full Code Here

  private void rerunTest(Test test) {
    if (!(test instanceof TestCase)) {
      showInfo("Could not reload "+ test.toString());
      return;
    }
    Test reloadedTest= null;
    TestCase rerunTest= (TestCase)test;
    try {
      Class reloadedTestClass= getLoader().reload(test.getClass());
      reloadedTest= TestSuite.createTest(reloadedTestClass, rerunTest.getName());
    } catch(Exception e) {
      showInfo("Could not reload "+ test.toString());
      return;
    }
    TestResult result= new TestResult();
    reloadedTest.run(result);

    String message= reloadedTest.toString();
    if(result.wasSuccessful())
      showInfo(message+" was successful");
    else if (result.errorCount() == 1)
      showStatus(message+" had an error");
    else
View Full Code Here

      showInfo("Initializing...");
      reset();

      showInfo("Load Test Case...");

      final Test testSuite= getTest(fSuiteField.getText());
      if (testSuite != null) {
        fRunner= new Thread() {
          public void run() {
            fTestResult= createTestResult();
            fTestResult.addListener(TestRunner.this);
            fProgressIndicator.start(testSuite.countTestCases());
            showInfo("Running...");

            long startTime= System.currentTimeMillis();
            testSuite.run(fTestResult);

            if (fTestResult.shouldStop()) {
              showStatus("Stopped");
            } else {
              long endTime= System.currentTimeMillis();
View Full Code Here

    textChanged();
  }

  private void rerun() {
    TestRunView view= (TestRunView)fTestRunViews.elementAt(fTestViewTab.getSelectedIndex());
    Test rerunTest= view.getSelectedTest();
    if (rerunTest != null)
      rerunTest(rerunTest);
  }
View Full Code Here

  private void rerunTest(Test test) {
    if (!(test instanceof TestCase)) {
      showInfo("Could not reload "+ test.toString());
      return;
    }
    Test reloadedTest= null;
    TestCase rerunTest= (TestCase)test;

    try {
      Class reloadedTestClass= getLoader().reload(test.getClass());
      reloadedTest= TestSuite.createTest(reloadedTestClass, rerunTest.getName());
    } catch(Exception e) {
      showInfo("Could not reload "+ test.toString());
      return;
    }
    TestResult result= new TestResult();
    reloadedTest.run(result);

    String message= reloadedTest.toString();
    if(result.wasSuccessful())
      showInfo(message+" was successful");
    else if (result.errorCount() == 1)
      showStatus(message+" had an error");
    else
View Full Code Here

    } else {
      setLoading(shouldReload());
      reset();
      showInfo("Load Test Case...");
      final String suiteName= getSuiteText();
      final Test testSuite= getTest(suiteName);
      if (testSuite != null) {
        addToHistory(suiteName);
        doRunTest(testSuite);
      }
    }
View Full Code Here

TOP

Related Classes of junit.framework.Test

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.