Content deleted Content added
+link from "assertion". |
|||
Line 1:
{{
'''Random testing''' is a black-box software testing technique where programs are tested by generating random, independent inputs. Results of the output are compared against software specifications to verify that the test output is pass or fail.<ref name="Hamlet94"/> In case of absence of specifications the exceptions of the language are used which means if an exception arises during test execution then it means there is a fault in the program.
==
Random testing for hardware was first examined by [[Melvin Breuer]] in 1971 and initial effort to evaluate its effectiveness was done by Pratima and [[Vishwani Agrawal]] in 1975.<ref>[http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1672882&tag=1 Agrawal, P.; Agrawal, V.D., "Probabilistic Analysis of Random Test Generation Method for Irredundant Combinational Logic Networks," Computers, IEEE Transactions on , vol.C-24, no.7, pp.691,695, July 1975]</ref>
In software, Duran and Ntafos had examined random testing in 1984.<ref>[http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=5010257 Duran, J. and S. Ntafos, An evaluation of random testing, IEEE Trans. Software Eng. SE-10 (July, 1984), 438-444]</ref> Earlier Howden had termed it functional testing in 1980.{{Citation needed|date=January 2015}}
==
Consider the following C++ function:
Line 22 ⟶ 21:
</syntaxhighlight>
Now the random tests for this function could be {123, 36, -35, 48, 0}. Only the value '-35' triggers the bug. If there is no reference implementation to check the result, the bug still could go unnoticed. However, an [[assertion (software development)|assertion]] could be added to check the results, like:
<syntaxhighlight lang="cpp">
Line 52 ⟶ 51:
While this example is limited to simple types (for which a simple random generator can be used), tools targeting object-oriented languages typically explore the program to test and find generators (constructors or methods returning objects of that type) and call them using random inputs (either themselves generated the same way or generated using a pseudo-random generator if possible). Such approaches then maintain a pool of randomly generated objects and use a probability for either reusing a generated object or creating a new one.<ref name="AutoTest"/>
==
According to the seminal paper on random testing by D. Hamlet
<blockquote>[..] the technical, mathematical meaning of "random testing" refers to an explicit lack of "system" in the choice of test data, so that there is no correlation among different tests.<ref name=Hamlet94>{{cite book|title=Encyclopedia of Software Engineering|year=1994|publisher=John Wiley and Sons|isbn=0471540021|author=Richard Hamlet|edition=1|editor=John J. Marciniak|accessdate=16 June 2013|chapter=Random Testing}}</ref></blockquote>
==
{{
Random testing is typically praised for the following strengths:
*
*
*
*
The following weaknesses are typically pointed out by detractors:
*
*
*
*
*
==
===
*
*
*
===
*
*
==
Some tools implementing random testing:
*
*
*
*
*
*
== Critique ==▼
<blockquote>Random testing has only a specialized niche in practice, mostly because an effective oracle is seldom available, but also because of difficulties with the operational profile and with generation of pseudorandom input values.<ref name="Hamlet94"/></blockquote>
An [[
For programming languages and platforms which have contracts (for example Eiffel. .NET or various extensions of Java like JML, CoFoJa...) contracts act as natural oracles and the approach has been applied successfully.<ref name="AutoTest">http://se.inf.ethz.ch/research/autotest/</ref> In particular, random testing finds more bugs than manual inspections or user reports (albeit different ones).<ref name="ManualvsRandom">{{cite journal|title=On the number and nature of faults found by random testing|year=2009|publisher=John Wiley and Sons|url=http://onlinelibrary.wiley.com/doi/10.1002/stvr.415/abstract|author=Ilinca Ciupa|author2=Alexander Pretschner|author3=Manuel Oriol|author4=Andreas Leitner|author5=Bertrand Meyer|journal=Software Testing, Verification and Reliability|doi=10.1002/stvr.415|volume=21|pages=3–28}}</ref>
==
*
*
*
*
*
*
==
{{
==
*
*
*
[[Category:Software testing]]
|