请输入您要查询的百科知识:

 

词条 Draft:Object state testing
释义

  1. Requirements

  2. Defects

  3. Object States

  4. State characterization

  5. Coverage

  6. Example

      State Definition    State transition spanning tree  

  7. See also

  8. References

{{AFC submission|d|v|u=143.179.14.34|ns=118|decliner=RoySmith|declinets=20190116170424|reason2=nn|ts=20181208122830}} {{AFC comment|1=My own searching finds mostly research papers by various combinations of Kung and Gao, mostly published in the mid-1990's. I found [https://books.google.com/books?id=5pnet_orFagC&lpg=PA176&ots=fPDTFXZTIO&dq=%22Object%20state%20testing%22&pg=PR2#v=onepage&q=%22Object%20state%20testing%22&f=false one book] that mentions it, but it's really just a passing mention. It's also not clear how reputable the publisher (Idea Group) is. At best, they're not a well-respected academic press. It's possible (I can't figure out exactly) that they're associated with an SEO factory (http://www.idea-group.com/). -- RoySmith (talk) 17:04, 16 January 2019 (UTC)}}

Object state testing is a formal white-box software test design method testing object state behavior. State testing is complementary to local error detection of functional and structural testing. Interaction of class member functions are tested through object state transitions..[1] An object behavior is state based arranged due to method invocation sequence, which behavior is established due to parameter values and state, providing successor and return value. The ranges of values of a subset of member data of the object defines a state of an object. State transitions are deterministic finite due to the conditional execution of member functions. Object state tests can be determined from the source code (white-box) or from the specifications (black-box).

Requirements

  1. Initial state
  2. Parameter arguments
  3. Expected return value
  4. Expected object successor state

Defects

To ensure robustness, all void and valid method sequence invocation combinations need to be tested using state test cases[2]. Testing the object state brings out below defects.

  1. Missing state transition
  2. Void transitions
  3. Wrong return value
  4. Void successor state

Object States

The behavior of a class object is definable characterized on inhabited data member values. The run time execution path is determined due to evaluating member and parameter values in decisions (condition), effecting the class object behavior. Object states are segmented in independent domain member data interval combinations leading towards different execution paths.

State characterization

  1. Examine all path conditions of member functions for conditional literals
  2. For each conditional literal found, form domain intervals such that the conditional literal is evaluated to either True or False for all values in the interval.

Coverage

The amount of states and paths are circumscribing test state coverage. Due to possible infinite cyclic path sequences the path length needs limitation. The amount of methods is a minimum criterion of path length for permutations of method sequences . Instead of limiting method permutation sequences an acyclic spanning tree is addressing systematically path length including negative and positive path combinations through a state space.

Example

A soda machine requires two 50c coins for a soda. It provides five methods and three class member variables. The variable tmp holds temporary coins till a customer withdraws a soda[3]

  1. !/anaconda/bin/python

class SodaMachine:

    total = 0    tmp = 0    withDraw = False
    def __init__(self):        self.reset()
    def add50c(self):        self.tmp = self.tmp + 1        if self.tmp > 1:            self.withDraw = True
    def return50cs(self):        self.tmp = 0
    def canWithDraw(self):        return self.withDraw
    def draw(self):        if self.withDraw:            self.total = self.total + self.tmp            self.tmp = 0            self.withDraw = False
    def reset(self):        self.total = 0        self.tmp = 0        self.withDraw = False
    if __name__ == '__main__':        sodaM = SodaMachine()        sodaM.add50c()        sodaM.add50c()        sodaM.draw()

State Definition

The class contains the conditions:

  1. add50c(): if self.tmp > 1
  2. draw(): if self.withDraw

The two conditions are segmenting the class member variable values into four states :

Member Interval
State tmp withDraw validity
False
True
True
False

State transition spanning tree

See also

  • Multiple condition coverage
  • Control flow graph
  • Decision to decision path
  • Elementary comparison testing

References

1. ^{{cite book |last1=Kung |first1=D. C. |first2=N. |last2=Suchak |first3=J. |last3=Gao and |first4=P. |last4=Hsia |first5=Y. |last5=Toyoshima|first6=C. |last6=Chen |chapter=On Object State Testing |chapterurl=|title=Proceedings of Computer Software and Applications Conference |year=1994 |pages=222--227 |publisher=IEEE Computer Society Press}}
2. ^Tilo Linz (2014). Testing in Scrum, p. 51, Rocky Nook Inc., Santa Barbara. {{ISBN|978-1-937538-39-2}}
3. ^https://github.com/jbloemendal/SodaMachine J. Bloemendal (2018), Test Case Design
随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/24 2:36:12