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

Re: [XP] Test first for AI

Expand Messages
  • Matthew Davis
    ... have to ... Checks ... trails, ... your ... and paste ... I just had a little insight into testing the hard-to-test things. Presumably, without TFD, you d
    Message 1 of 19 , Aug 31, 2001
    • 0 Attachment
      --- In extremeprogramming@y..., Phlip <pplumlee@c...> wrote:
      > On Thursday 30 August 2001 07:04, you wrote:
      > > I am having a problem with some artificial intelligence test code
      > > I am writing for academic work. The problem is with respect to
      > ...
      > The research space is outside the ken of raw XP. The bad news is we
      have to
      > fall back on the less Agile practices - Small Up Front Design, Guru
      Checks
      > Output, & Test Last. The good news is these are already well-beaten
      trails,
      > and nobody cares about Velocity.
      >
      > Bow to the Test First gods, but then don't test random outputs. Test
      your
      > chromosomes are the correct length. After the code runs, set your
      > pseudo-random number generator to a known seed, sample the output,
      and paste
      > the output back into your test.

      I just had a little insight into testing the hard-to-test things.
      Presumably, without TFD, you'd have some non-test way of giving
      yourself confidence the code works. In most cases, this will involve
      running the test. Maybe you run it, give it a few different inputs,
      and examine the output to see if it works. Maybe you run it, then
      step through the debugger to make sure everything behaves as you
      thought it would.

      Whatever it is, try to capture that in a test.

      For example, without TFD, you might debug into the crossover code.
      After you got your random locus, you'd probably examine it to ensure
      that it's in a valid range, then you'd examine the arrays, step
      through the crossover code, and re-examine the arrays, ensuring that
      the crossover occurred where the random locus (examined earlier) said
      it should.

      So, that's what you need to automate. Of course, that means you need
      to give the test access to the locus, the input arrays, and the output
      arrays... which could well lead to refactoring the locus determination
      out to the test code or "mocking" the random number generator.

      -Matthew
      azami@...
    Your message has been successfully submitted and would be delivered to recipients shortly.