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


Groups > comp.programming > #5531

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

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed1.swip.net!uio.no!nntp.uio.no!.POSTED!not-for-mail
From Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no>
Newsgroups comp.programming
Subject Re: How to write a test with random usage patterns?
Date Tue, 28 Jul 2015 15:03:59 +0200
Organization University of Oslo, Norway
Lines 29
Message-ID <hbf.20150728dboy@bombur.uio.no> (permalink)
References <hbf.20150727d459@bombur2.uio.no> <mp7oqm$ka3$1@dont-email.me>
NNTP-Posting-Host bombur.uio.no
Mime-Version 1.0
Content-Type text/plain
X-Trace readme.uio.no 1438088639 866 129.240.203.105 (28 Jul 2015 13:03:59 GMT)
X-Complaints-To abuse@uio.no
NNTP-Posting-Date Tue, 28 Jul 2015 13:03:59 +0000 (UTC)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock sha1:9V63Oj3+t0w7HcvCxSZ44UwlOGM=
Xref csiph.com comp.programming:5531

Show key headers only | View raw


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.  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.  So the bit strings
don't help generate interesting test cases.  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.

> 5) randomly flip a small but random number of bits.
> Then go round again, and again, and again.
>
> Evolution in action.

-- 
Hallvard

Back to comp.programming | Previous | Next — Previous in thread | Next 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