Jump to content

Random testing

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mianasbat (talk | contribs) at 12:55, 16 February 2012 (Created page with 'Random Testing is a software testing technique where programs are tested by generating random inputs. Results of the output are compared against software specifi...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Random Testing is a software testing technique where programs are tested by generating random inputs. Results of the output are compared against software specifications. In case of absence of specifications the exceptions of the language are considered. So in a simple example if we have the following java program


public class Test { public void xyz ( int a , int b ) int sum = a/b; System.out.println(" The result is : " + result); }

Now if the above program is given to random testing technique for testing then the technique will generate random values for a and b e.g. it generates {1, 7, 100, 10000, -15} for a and {-30, 0, 15, 6, 1, 1000} for b. Now in first case a = 1 and b = -30 so sum = 1/-30 = -29 so the test passes but for second test a = 7 and b = 0 so sum = 7/0 = infinity and the java compiler will throw division by zero exception. Thus the random testing will show the that the program fail for a = 7 and b = 0. Which can be then removed by the debugging team.