Software Engineering-Interclass Test case Design

Test case design becomes more complicated as integration of the OO system begins. It is at this stage that testing of collaborations betwee...


Test case design becomes more complicated as integration of the OO system begins. It is at this stage that testing of collaborations between classes must begin. To illustrate “interclass test case generation” , we expand the banking example to include the classes and collaborations noted in Figure below The direction of the arrows in the figure indicates the direction of messages and the labeling indicates the operations that are invoked as a consequence of the collaborations implied by the messages.




Like the testing of individual classes, class collaboration testing can be accomplished by applying random and partitioning methods, as well as scenario-based testing and behavioral testing.

Multiple Class Testing

Kirani and Tsai suggest the following sequence of steps to generate multiple class random test cases:

1. For each client class, use the list of class operations to generate a series of random test sequences. The operations will send messages to other server classes.

2. For each message that is generated, determine the collaborator class and the corresponding operation in the server object.

3. For each operation in the server object (that has been invoked by messages sent from the client object), determine the messages that it transmits.

4. For each of the messages, determine the next level of operations that are invoked and incorporate these into the test sequence.

To illustrate , consider a sequence of operations for the bank class relative to an ATM class :

verifyAcct•verifyPIN•[[verifyPolicy•withdrawReq]|depositReq|acctInfoREQ]n

A random test case for the bank class might be

test case r3 = verifyAcct•verifyPIN•depositReq

In order to consider the collaborators involved in this test, the messages associated with each of the operations noted in test case r3 is considered. Bank must collaborate with ValidationInfo to execute the verifyAcct and verifyPIN. Bank must collaborate with account to execute depositReq. Hence, a new test case that exercises these collaborations is The approach for multiple class partition testing is similar to the approach used for partition testing of individual classes.  However, the test sequence is expanded to include those operations that are invoked via messages to collaborating classes. An alternative approach partitions tests based on the interfaces to a particular class. Referring to figure, the bank class receives messages from the ATM and cashier classes. The methods within bank can therefore be tested by partitioning them into those that serve ATM and those that serve cashier. State-based partitioning  can be used to refine the partitions further.

Tests Derived from Behavior Models

We already discussed the use of the state transition diagram as a model that represents the dynamic behavior of a class. The STD for a class can be used to help derive a sequence of tests that will exercise the dynamic behavior of the class (and those classes that collaborate with it). Figure below illustrates an STD for the account class  Referring to the figure, initial transitions move through the empty acct and setup acct states. The majority of all behavior for instances of the class occurs while in the working acct state. A final withdrawal and close cause the account class to make transitions to the nonworking acct and dead acct states, respectively.

test case r4 = verifyAcctBank[validAcctValidationInfo]•verifyPINBank•
                    [validPinValidationInfo]•depositReq• [depositaccount] 

The tests to be designed should achieve all state coverage . That is, the operation sequences should cause the account class to make transition through all allowable states:

test case s1: open•setupAccnt•deposit (initial)•withdraw (final)•close

It should be noted that this sequence is identical to the minimum test sequence . Adding additional test sequences to the minimum sequence,

test case s2: open•setupAccnt•deposit(initial)•deposit•balance•credit•withdraw (final)•close
test case s3: open•setupAccnt•deposit(initial)•deposit•withdraw•accntInfo•withdraw (final)•close

Still more test cases could be derived to ensure that all behaviors for the class have been adequately exercised. In situations in which the class behavior results in a collaboration with one or more classes, multiple STDs are used to track the behavioral flow of the system.

The state model can be traversed in a “breadth-first”  manner. In this context, breadth first implies that a test case exercise a single transition and that when a new transition is to be tested only previously tested transitions are used.

Consider the credit card object discussed earlier. The initial state of credit card is undefined (i.e., no credit card number has been provided). Upon reading the credit card during a sale, the object takes on a defined state; that is, the  attributes card number and expiration date, along with bank specific identifiers are defined. The credit card is submitted when it is sent for authorization and it is approved when authorization is received. The transition of credit card from one state to another can be tested by deriving test cases that cause the transition to occur. A breadth-first approach to this type of testing would not exercise submitted before it exercised undefined and defined. If it did, it would make use of transitions that had not been previously tested and would therefore violate the breadth-first criterion.
Name

ADO,131,ASP,3,C++,61,CORE JAVA,1,CSS,115,HTML,297,index,5,JAVASCRIPT,210,OS,47,PHP,65,SAD,53,SERVLETS,23,SOFTWARE ENGINEERING,245,SQL,71,TCP/IP,1,XHTML,9,XML,18,
ltr
item
Best Online Tutorials | Source codes | Programming Languages: Software Engineering-Interclass Test case Design
Software Engineering-Interclass Test case Design
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguyrjGK0Ahxcjy-Kzzovga8ejVttczwfohma60OxI-Kt7V4PgjlfLlKMIRR-GHFmE7JkyMNBDdqx94bWuZ05FjDcon3h0T0tlcyxDr2FWg0wMWauEJHyPHXzYz7eAnAcvZTU2FSvzqv3Pi/s400/Capture.PNG
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguyrjGK0Ahxcjy-Kzzovga8ejVttczwfohma60OxI-Kt7V4PgjlfLlKMIRR-GHFmE7JkyMNBDdqx94bWuZ05FjDcon3h0T0tlcyxDr2FWg0wMWauEJHyPHXzYz7eAnAcvZTU2FSvzqv3Pi/s72-c/Capture.PNG
Best Online Tutorials | Source codes | Programming Languages
https://www.1000sourcecodes.com/2012/05/software-engineering-interclass-test.html
https://www.1000sourcecodes.com/
https://www.1000sourcecodes.com/
https://www.1000sourcecodes.com/2012/05/software-engineering-interclass-test.html
true
357226456970214079
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content