Loading ...
Sorry, an error occurred while loading the content.
 

Re: [junit] What does conventional wisdom say?

Expand Messages
  • Cédric Beust ♔
    ... Why not simply pass a boolean parameter to your test? -- Cédric [Non-text portions of this message have been removed]
    Message 1 of 4 , Oct 1, 2006
      On 9/30/06, David Saff <saff@...> wrote:
      >
      > > So, I'd really have only one test method that would get called, and he
      > > would pick whether to do the real compare or fake it out. Later on,
      > > when compare is ready to be integrated, then we'd flip that testCompare
      > > switch to true, and then we would have an end-to-end test. How would
      > > that do?
      >
      > I would personally just have two tests in the end: one with the fake,
      > and one with the real comparison. You could disable the real comparison
      > with an @Ignore flag, if you're using JUnit 4. Does that make sense in
      > your situation?


      Why not simply pass a boolean parameter to your test?

      --
      Cédric


      [Non-text portions of this message have been removed]
    • David Saff
      ... Because it seems that there are two different, but related, things that the original poster wanted to test: 1) Given that the comparison routine is
      Message 2 of 4 , Oct 2, 2006
        Cédric Beust ♔ wrote:
        > On 9/30/06, David Saff <saff@...> wrote:
        >
        >> I would personally just have two tests in the end: one with the fake,
        >> and one with the real comparison. You could disable the real comparison
        >> with an @Ignore flag, if you're using JUnit 4. Does that make sense in
        >> your situation?
        >>
        >
        >
        > Why not simply pass a boolean parameter to your test?
        >
        >

        Because it seems that there are two different, but related, things that
        the original poster wanted to test:

        1) Given that the comparison routine is correct, does this module work?
        2) Given the current definition of the comparison routine, does this
        module work?

        Two named parameterless methods is the simplest way I can think of to
        write two tests in JUnit. Similarities can be extracted into helper
        methods, but the complexity of a parameterized test seems unjustified in
        this case.

        David
      Your message has been successfully submitted and would be delivered to recipients shortly.