1 2 Previous Next 20 Replies Latest reply on Nov 14, 2008 9:08 AM by salaboy21 Go to original post
      • 15. Re: fork and join childeren
        tbee

         

        "kukeltje" wrote:
        But before I can assert something, I need to see it first... Are there really two tokens? Yes... Ok, assert.


        I disagree. You can assert ANYTHING, e.g. assert that you expect one token. The test fails because there are more tokens. Assert that the token is in a certain state: it succeeds or fails and the real value is always printed.... I initially did it as you mention, but starting with assertions is way easier and more understandable for others if something goes wrong.


        I do not understand the problem. In order to assert something I first need to check if my idea of what is suppose to happen is correct. There will be no others that ever see the println statements, because they will be remove immediately after it turns out I get it. I use the unittest to build my understanding of, in this case, jbpm, and at the same time create behavioral checks.

        • 16. Re: fork and join childeren
          salaboy21

          if you wanna really see the values variables and tokens you must debug...
          And remember that asserts are basic concept in JUnit testing... so... try to leave println...

          • 17. Re: fork and join childeren
            kukeltje

             

            if you wanna really see the values variables and tokens you must debug...

            +1

            so... try to leave println...

            leave as in abandon/ditch/get rid of... I guess...

            I do not understand the problem. In order to assert something I first need to check if my idea of what is suppose to happen is correct.


            That is what you do with an assert.... It prints values as well if they do not match... So you can see what you get is what you expect.

            There will be no others that ever see the println statements, [/quote

            We did and you had to write lots of text explaning what you expected and there were (natural) language barriers.

            Personally I do not investigate these kinds of problem reports anymore since it takes WAY to much time, but I respect Mauricio for still doing it.


            • 18. Re: fork and join childeren
              kukeltje

              sorry for not using preview and messing up the previous post

              • 19. Re: fork and join childeren
                tbee

                Ok.

                Now, I fully appriciate the help you guys are giving me. Again many thanks for that. And I even appriciate the promotion of unittests, although you are talking to an already converted believer. But I do think it is a bit overdone to try to tell me how I should work my way to a unittest, as long as -when I'm done- there is a nice unittest with assertions.

                So when I'm busy learning something (like JBPM here) I prefer prints. Simple, straight forward and it outputs the info exactly at the right time, over and over again, without me having to think in advance about what should be there. Token classes? Node classes? Iterator? I'm learning what should be there, prints are telling me this, and then I can replace the prints with assert and continue to the next part. Step by step.

                I most definitely use debuggers, but for when I need to trace the execution, and they often involve tiredsome manual "step-in", "execute-out", "run-to" and other program flow management, which I do not like. Especially if certain pieces of code have to be navigated multiple times. Plus, how do you think I should have illustrated my problem we discussed in the thread? Make a movieclip of the debugger screen?

                So, again, I'm very grateful for the help, and I'm a great proponent for unittests, but let's keep the how-to-get-there to each's personal taste. I use intermediate prints, you guys use asserts. Great. At least we all write unittests.

                • 20. Re: fork and join childeren
                  salaboy21

                  right!
                  It's ok!!
                  I that you can probe the same with asserts.. but.. obviously here all understand the to methods...

                  Thanks and good look with jBPM!!!

                  1 2 Previous Next