Content deleted Content added
update the definition of test oracle from an article (and updated the reference -- the previous one was broken) |
Rescuing 3 sources and tagging 1 as dead.) #IABot (v2.0.9.5 |
||
(6 intermediate revisions by 5 users not shown) | |||
Line 1:
{{Short description|Provider of information for software testing}}
{{Use American English|date=January 2021}}
{{other uses|Oracle (disambiguation)}}
In [[software testing]], a '''test oracle''' (or just '''oracle''') is a provider of information that describes [[Correctness (computer science)|correct]] output based on the input of a [[test case (software)|test case]]. Testing with an oracle involves comparing actual results of the system under test (SUT) with the expected results as provided by the oracle.<ref>Earl T. Barr et al; ''[https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=6963470 The Oracle Problem in Software Testing: A Survey]'', 2015</ref>
given an input for a system a '''test oracle''' (or just '''oracle''') is a procedure that distinguishes between the correct and incorrect behaviors of the System Under Test (SUT)<ref>Earl T. Barr et al; ''[https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=6963470 The Oracle Problem in Software Testing: A Survey]'', 2015</ref>. The use of oracles involves comparing the output(s) of the system under test, for a given [[test case|test-case]] input, to the output(s) that the oracle determines that product should have. The term "test oracle" was first introduced in a paper by William E. Howden.<ref>{{cite journal |last1=Howden |first1=W.E. |date=July 1978 |title=Theoretical and Empirical Studies of Program Testing |journal=IEEE Transactions on Software Engineering |volume=4 |issue=4 |pages=293–298 |doi=10.1109/TSE.1978.231514 }}</ref> Additional work on different kinds of oracles was explored by [[Elaine Weyuker]].<ref>Weyuker, Elaine J.; "The Oracle Assumption of Program Testing", in ''Proceedings of the 13th International Conference on System Sciences (ICSS), Honolulu, HI, January 1980'', pp. 44-49</ref>▼
▲
An oracle can operate separately from the SUT; accessed at test [[Runtime (program lifecycle phase)|runtime]], or it can be used before a test is run with expected results encoded into the test logic.<ref name="038720881X">Jalote, Pankaj; ''An Integrated Approach to Software Engineering'', Springer/Birkhäuser, 2005, {{ISBN|0-387-20881-X}}</ref>
However, [[Method (computer programming)|method]] postconditions are part of the SUT, as automated oracles in [[design by contract]] models.<ref>{{cite journal |last1=Meyer |first1=Bertrand |last2=Fiva |first2=Arno |last3=Ciupa |first3=Ilinca |last4=Leitner |first4=Andreas |last5=Wei |first5=Yi |last6=Stapf |first6=Emmanuel |date=September 2009 |title=Programs That Test Themselves |journal=Computer |volume=42 |issue=9 |pages=46–55 |doi= 10.1109/MC.2009.296 }}</ref>
Determining the correct output for a given input (and a set of program or system states) is known as the ''oracle problem'' or ''test oracle problem'',<ref name="Oracle survey"/>{{rp|507}} which some consider a relatively hard problem, and involves working with problems related to controllability and observability.<ref name="ammann-intro">Ammann, Paul; and Offutt, Jeff; "Introduction to Software Testing, 2nd edition", ''Cambridge University Press'', 2016, {{ISBN|978-1107172012}}</ref>
== Categories ==
Line 12 ⟶ 18:
=== Specified ===
Specified
=== Derived ===
A derived test oracle differentiates correct and incorrect behavior by using information derived from artifacts of the system. These may include documentation, system execution results and characteristics of versions of the
A pseudo-oracle<ref name="Oracle survey"/>{{rp|515}} falls into the category of derived test oracle. A pseudo-oracle, as defined by Weyuker,<ref name="pseudo-oracle">{{cite journal |last1=Weyuker |first1=E.J. |date=November 1982 |title=On Testing Non-Testable Programs |journal=The Computer Journal |volume=25 |issue=4 |pages=465–470 |doi=10.1093/comjnl/25.4.465 |doi-access=free }}</ref> is a separately written program which can take the same input as the program or
A partial oracle<ref name="Oracle survey"/>{{rp|515}} is a hybrid between specified test oracle and derived test oracle. It specifies important (but not complete) properties of the
=== Implicit ===
Line 32 ⟶ 38:
=== Human ===
== Examples ==
Test oracles are most commonly based on [[Specification (technical standard)|specifications]] and [[software documentation|documentation]].<ref>{{cite thesis | last = Peters | first = Dennis K. | citeseerx = 10.1.1.69.4331 | title = Generating a Test Oracle from Program Documentation | publisher = McMaster University | degree = M. Eng. | year = 1995 }}</ref><ref>{{cite conference | last1 = Peters | first1 = Dennis K. | last2 = Parnas | first2 = David L. | url = http://www.engr.mun.ca/~dpeters/papers/issta.pdf | title = Generating a Test Oracle from Program Documentation | book-title = Proceedings of the 1994 International Symposium on Software Testing and Analysis | conference = ISSTA | publisher = ACM Press | pages = 58–65 }}</ref> A formal specification used as input to [[model-based design]] and [[model-based testing]] would be an example of a ''specified test oracle''. The ''model-based oracle'' uses the same model to generate and verify system behavior.<ref>Robinson, Harry; [http://www.harryrobinson.net/MBT-on-a-shoestring.pdf ''Finite State Model-Based Testing on a Shoestring'']{{Dead link|date=August 2025 |bot=InternetArchiveBot |fix-attempted=yes }}, STAR West 1999</ref> Documentation that is not a full specification of the product, such as a usage or installation guide, or a record of performance characteristics or minimum machine requirements for the software, would typically be a derived test oracle.
A consistency oracle compares the results of one test execution to another for similarity.<ref>Hoffman, Douglas; [http://www.softwarequalitymethods.com/Papers/OracleTax.pdf ''Analysis of a Taxonomy for Test Oracles''] {{Webarchive|url=https://web.archive.org/web/20120310100741/http://www.softwarequalitymethods.com/Papers/OracleTax.pdf |date=2012-03-10 }}, Quality Week, 1998</ref> This is another example of a derived test oracle.
An oracle for a software program might be a second program that uses a different [[algorithm]] to evaluate the same mathematical expression as the product under test. This is an example of a pseudo-oracle, which is a derived test oracle.<ref name="pseudo-oracle"/>{{rp|466}}
Line 44 ⟶ 50:
During [[Google]] search, we do not have a complete oracle to verify whether the number of returned results is correct. We may define a metamorphic relation<ref>{{cite journal |first1=Z.Q. |last1=Zhou |first2=S. |last2=Zhang |first3=M. |last3=Hagenbuchner |first4=T.H. |last4=Tse |first5=F.-C. | last5=Kuo |first6=T.Y. |last6=Chen |date=2012 |title=Automated functional testing of online search services |journal=Software Testing, Verification and Reliability |volume=22 |issue=4 |pages=221–243 |doi=10.1002/stvr.437 |hdl=10722/123864 |hdl-access=free }}</ref> such that a follow-up narrowed-down search will produce fewer results. This is an example of a partial oracle, which is a hybrid between specified test oracle and derived test oracle.
A statistical oracle uses probabilistic characteristics,<ref>{{cite conference |url=http://www.mathematik.uni-ulm.de/sai/mayer/publications/oracles.pdf |title=Test Oracles Using Statistical Methods |last1=Mayer |first1=Johannes |last2=Guderlei |first2=Ralph |date=2004 |publisher=Springer |book-title=Proceedings of the First International Workshop on Software Quality, Lecture Notes in Informatics |pages=179–189 |conference=First International Workshop on Software Quality |access-date=2009-09-09 |archive-date=2017-08-09 |archive-url=https://web.archive.org/web/20170809023446/http://www.mathematik.uni-ulm.de/sai/mayer/publications/oracles.pdf |url-status=dead }}</ref> for example with image analysis where a range of certainty and uncertainty is defined for the test oracle to pronounce a match or otherwise. This would be an example of a quantitative approach in human test oracle.
A heuristic oracle provides representative or approximate results over a class of test inputs.<ref>Hoffman, Douglas; [http://www.softwarequalitymethods.com/Papers/STQE%20Heuristic.pdf Heuristic Test Oracles] {{Webarchive|url=https://web.archive.org/web/20160314144359/http://www.softwarequalitymethods.com/Papers/STQE%20Heuristic.pdf |date=2016-03-14 }}, Software Testing & Quality Engineering Magazine, 1999</ref> This would be an example of a qualitative approach in human test oracle.
== References ==
|