Menu

assert terminates test

Help
mr.x
2005-02-11
2013-04-09
  • mr.x

    mr.x - 2005-02-11

    I run a (JFCUnit)-TestCase  under Eclipse, after
    an assert-statement my testCase terminates, even
    if it's not the end of the testCase.
    Also is the assert-statement not evalutated.
    (I tried a simple assertEquals("a", "b");, but no failure
    occurs)

    When going into the assert-statement with the Debugger, the assert-statement is evaluated correctly and then the testCase terminates also.

    some ideas ....? thanx

     
    • Kevin L Wilson

      Kevin L Wilson - 2005-03-21

      I believe there were some problems with older versions not catching the exceptions properly. What version are you using?
      Are you using XML interface to the test cases?

      I do not have enough information on your environment to look into this issue.

      Kevin

       
      • Grenie

        Grenie - 2006-05-17

        Has anyone a Solution for this Problem?
        I have the same Problem as koehnen and find no solution for it. I thought it depends on eclipse, but with eclipse 3.1 the problem occurs, also.

         
    • Kevin Duffey

      Kevin Duffey - 2005-03-22

      assertEquals("A","B"), look at the methods, you'll see that the first parameter is a message that can be reported, the second is the evaluation. This comes from the JUnit level.

      You want

      assertEquals("It failed.", "a".equals("b"));

      or "a" == "b"

       
    • Ritesh Trivedi

      Ritesh Trivedi - 2005-03-22

      Use Assert.assertEquals from the JUnit API instead and let us know if that works.

      Here is the snippet from JUnit API
      static void assertEquals(java.lang.String message, java.lang.String expected, java.lang.String actual)
                Asserts that two Strings are equal.

       
    • Grenie

      Grenie - 2006-05-18

      Hi, as i mentioned befor i had a similary problem.

      @koehnen:
      Did you use the method clearUp from the class TestHelper?

      this was my problem. The ClearUp - Method terminates the test. In my case the problem was that i had used in my frame JFrame.EXIT_ON_CLOSE for the defaultcloseoperation. I use now JFrame.DISPOSE_ON_CLOSE and it works.

      the class TestHelper use resumeAWT() and as far as i know generates this an error when the frame is closed by System.exit(0).

       

Log in to post a comment.