Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #5532

Re: How to write a test with random usage patterns?

From Richard Heathfield <rjh@cpax.org.uk>
Newsgroups comp.programming
Subject Re: How to write a test with random usage patterns?
Date 2015-07-28 17:17 +0100
Organization go, ion artisan!
Message-ID <mp89rt$t9l$1@dont-email.me> (permalink)
References <hbf.20150727d459@bombur2.uio.no> <mp7oqm$ka3$1@dont-email.me> <hbf.20150728dboy@bombur.uio.no>

Show all headers | View raw


On 28/07/15 14:03, Hallvard Breien Furuseth wrote:
> Richard Heathfield <rjh@cpax.org.uk> writes:
>> Find a way to express a test case as a sequence of bits, such that *any*
>> sequence of bits represents a valid test case. Then generate a few
>> hundred random bit sequences. Test them. If possible, identify the
>> bitstrings that detect bugs, and flag them. Keep any that have the flag,
>> and throw the rest out. Then generate new test cases as follows:
>
> That sounds pretty cool once we've found a bug.

Good point. :-)  In the meantime, you'd need a less finicky fitness 
function, wouldn't you?

> Until then though, it
> seems to be just the same as "switch (rand() % COUNT)" - there'll be no
> patterns in the bit strings beyond random noise.

At first, yes. This is typical of genetic algorithms - the interesting 
behaviour takes a while to emerge.

> So the bit strings
> don't help generate interesting test cases.

I think you're correct at the start, but I also think they will help to 
generate /more/ interesting test cases (once you have some that are even 
mildly interesting), if you get your fitness function right.

> That is, I'm hoping to
> decompose "test cases" in small steps, then assemble them in more
> interesting ways than just random order would achieve.
>
>> 1) take two test cases at random;
>> 2) take a random number of bits from the first test case;
>> 3) take a random number of bits from the second test case, and catenate;
>> 4) repeat from 2) until you have a valid test case;
>
> I gather there's no need for (4) here, since you said any bit string is
> a valid test case.

Just making sure it's long enough, that's all - I assume (and it may not 
be necessary to assume, but probably simpler if you do) that a test case 
consists of precisely N bits.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

Back to comp.programming | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

How to write a test with random usage patterns? Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no> - 2015-07-27 14:48 +0200
  Re: How to write a test with random usage patterns? Julio Di Egidio <julio@diegidio.name> - 2015-07-27 07:19 -0700
    Re: How to write a test with random usage patterns? Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no> - 2015-07-27 17:00 +0200
      Re: How to write a test with random usage patterns? Julio Di Egidio <julio@diegidio.name> - 2015-07-27 08:42 -0700
        Re: How to write a test with random usage patterns? Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no> - 2015-07-28 12:53 +0200
  Re: How to write a test with random usage patterns? Julio Di Egidio <julio@diegidio.name> - 2015-07-27 07:42 -0700
  Re: How to write a test with random usage patterns? Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no> - 2015-07-28 12:55 +0200
  Re: How to write a test with random usage patterns? Richard Heathfield <rjh@cpax.org.uk> - 2015-07-28 12:26 +0100
    Re: How to write a test with random usage patterns? Julio Di Egidio <julio@diegidio.name> - 2015-07-28 05:20 -0700
    Re: How to write a test with random usage patterns? Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no> - 2015-07-28 15:03 +0200
      Re: How to write a test with random usage patterns? Richard Heathfield <rjh@cpax.org.uk> - 2015-07-28 17:17 +0100

csiph-web