Presentation is loading. Please wait.

Presentation is loading. Please wait.

Functional Testing Testing against the Requirements

Similar presentations


Presentation on theme: "Functional Testing Testing against the Requirements"— Presentation transcript:

1 Functional Testing Testing against the Requirements
Properties of a Function Functional Processes Nested Functions Functional Hierarchy SOFSPEC Function Definition Potential Functional Test Oracles Test against the User Documentation Testing against a Specification Test Cases from Decision Tables Test Cases from Decision Trees Test Cases from Business Rules Testing against a Requirement Net Testing a Patient Monitoring System Testing Use Cases of an ATM The Use Case Specification Sample Use Case Description From the Use Case to Test Cases Testing against an operational Profile Extracting Test Cases from Production Testcase Recording Operational Profile as a Feedback Loop Functional Test Coverage Test the Business Rules of an Order Entry System 1 13 2 14 3 15 4 16 5 17 6 18 7 19 8 20 9 21 10 22 11 23 12 24 1

2 Testing against the Requirements
FUNC-1 Requiremnt Specification (Oracle) Software System Functional Testing means testing the System against the Requirement Specification (functional & non-functional Requirements) 2

3 Properties of a Function
TEST FUNC-2 Trigger (Pre Conditions) (Post Conditions) Function (f) Input domain Output domain Y X i Input States (1:N) Output States (1:N) Process- ing Rules Business Rule X i f (Y ) = 3

4 Functional Processes Input Domain Output Domain X (1) Y (1)
TEST FUNC-3 Input Domain Output Domain X (1) Y (1) Original State Function (1) X (2) Y (2) Intermediate State Pre Conditions Function (2) Post Conditions X (1:4) Y (1:4) X (3) Y (3) Intermediate State Function (3) X (4) Y (4) Final State 4

5 Nested Functions General, abstract Functions detailed Basic function
TEST FUNC-4 General, abstract Functions detailed Basic function Basic function Functions Functional Hierarchy To what level of granularity should functions be tested? 5

6 Functional Hierarchy Business Function Main Function Use Case
TEST FUNC-5 Business Function Main Function Use Case Main Function Use Case Main Function Use Case Sub- function Sub- function Sub- function F F F The Goal is, to exercise every elementary Function in all variations Elementary Functions

7 SOFSPEC Function Definition
TEST FUNC-6 F U N C T I O N H E A D E R Name: This_Function Typ: ELEM Version: 1 Kategorie: U Anzahl: N Purpose: Text Test Assertions Processing Rule ASSERT PRE EIN E RANGE (10+10); Read an Object EIN ASSERT PRE Y E RANGE (0:100); Compute X = Y - Z ASSERT PRE Z E SET (2,4,6,8); Set Object AUS to X ASSERT POST X = Y - Z Write AUS ASSERT POST AUS = X

8 Potential Functional Test Oracles
User- Requirement Doc Specification Langiuage System Prototype Usage Guide Z VDL RSL UML OCL Operational Profile According to William Howden "Functional Program Testing"

9 Testing against the User Guide
FUNC-8 BASE-OBJEKT: XXXXXXXXXXXXXXXX ACT LINE-NR REL-TYPE COND TARGET-OBJEKT X XXX X XXXXXXXXXXXXXX To create an Object/Object Relation, you must first submit the name of a valid base Object - a string of 32 characters starting with a letter. After that, you can submit a line for each target object with the action, line number, relation type, condition and name. ACT = A for ADD or C for CHANGE, LINE-NR = 1:999 REL-TYPE = 1:1 / 1:N / M:1 / M/N COND = U for UNCONDITIONAL or C for CONDITIONAL TARGET-OBJECT = A Valid Object Name Testcase 1: Invalid Base Object name Testcase 2: Undefined Action ACT = Delete Testcase 3: Invalid LINE-NR < 1 or > 999 Testcase 4: Invalid Relation REL-TYPE = N:M Testcase 5: Invalid Condition COND = ' ' Testcase 6: Invalid Target Object Name Testcase 7: Add a 1:1 unconditional Relation Testcase 8: Add a 1:N conditional Relation Testcase 9: Change an M:1 unconditional Relation Testcase 10: Change an M:N conditional Relation 9

10 Testing against a formal Specification
FUNC-9 Specification Test = Function Tree Test Cases + Decision Logic Pre/Post- In/ Out- Data Domains Test Data

11 Extracting Test Cases from Decision Tables
FUNC-10 Rules OrderedAmount = Valid N J J J OrderedAmount > AmountonStock J N N AmountonStock < MinimumLevel N J Display “Invalid Order Amount"  Display “Insufficient Amount on Stock“  Fulfill Order & reduce Amount on Stock   Generate resupply order  Conditions Actions One Test case per Rule = 4 Test Cases 11

12 Extracting Test Cases from Decision Trees
FUNC-11.1 Decision Tree Process_Order Check_Amount_Stock @ Display_Order_too_large_Error (1) PreCondiition: IF AmountonStock < OrderedAmount @ Reduce_AmountonStock (2) PreCondition: IF AmountonStock NOT < OrderedAmount @ Check_StockLevel (3) Precondition: IF AmountonStock NOT < OrderedAmount @ Generate_ResupplyOrder (3) Precondition: IF (AmountonStock < MinimumLevel)

13 TEST FUNC-11.2 Test Cases 1 * Display_Order_too_large_Error IF (TESTCASE = 1) THEN ASSERT PRE AmountonStock < OrderedAmount; END; 2 * Reduce_AmountonStock IF (TESTCASE = 2) THEN ASSERT PRE AmountonStock > OrderedAmount; END; 3 * Generate_ResupplyOrder IF (TESTCASE = 3) THEN ASSERT PRE AmountonStock = OrderedAmount; ASSERT PRE AmountonStock < MinimumLevel; END;

14 Extracting Test Cases from Business Rules
FUNC-12 Service Function Test Case Generation Action Description If Account_Balance minus the withdrawal is more than the credit limit allow the withdrawal In case the withdrawal causes the Account_Balance to fall below the credit limit refuse the withdrawal. Test Case 1 2 3 4 Account_Balance minus the withdrawal is more than the credit limit Y Y N N Withdrawal causes the Account_Balance to fall below the credit limit Y N Y N Allow the withdrawal - X - - Refuse the withdrawal X - X - Each Condition is treated separately and combined with the other conditions in the same action to give the number of testcases = nr_conditions2 Conditional keywords are scanned.

15 Testing against a Requirement Net (1976)
FUNC-13 R-Net Patient Monitoring Receive Message ASSERT Report Measurement Error Store Measurement Check Measurement ASSERT ASSERT Invalid Measure Valid Measure Report Patient ok Report Patient in danger Validation Points ASSERT ASSERT Safe Range Out of safe Range

16 Testing a Patient Monitoring System
FUNC-14 R-Net-Entry Measuring device Requirement Specification with RSL Patient Monitoring System Receive Message invalid Measure or Valid Measure and & Report Measure Error Store Measure Check Measure Patient ok or Patient in danger System Display Message Log 1. Test Report ok Alarm Nurse on Duty 2. Test Alarm Display 3. Test

17 Testing Use Cases of an ATM
FUNC-15 Deposit uses Withdrawal administer Account uses Transfer uses Account Status Print Balance Customer extends

18 The Use Case Specification
TEST FUNC-16 Use Case Name Purpose Description of Steps Pre- Conditions Post- Conditions Alternatives Error Handling

19 Sample Use Case Description
TEST FUNC-17 Name: Withdrawal Purpose: withdraw money from ATM Steps: 1) Customer submits Bank card and PIN-Nr. 2) Customer selects Amount 3) Account is checked if balance covers withdrawal 4) Balance is reduced by withdrawal Amount 5) ATM ejects the money Pre Condition: Bank Card is valid PIN-Number is correct Amount < (Balance + CreditLimit) Post Condition: Balance = Last.Balance - Amount if (Bank Card valid & PIN-Number correct & Amount < (Last.Balance + CreditLimit)

20 From Use Case to Test Cases
FUNC-18 Pre Conditions: Functional Test Cases PIN-Number B G G G G Bank Card - B G G G Amount > (Balance + CreditLimit) = (Balance + CreditLimit) < (Balance + CreditLimit) Post Conditions: Money N N N J J Message Incorrect PIN Invalid Card Account overdrawn ok ok G = Good B = Bad

21 Testing against an operational Profile
FUNC-19 Software Product Application Monitor Monitor Monitor Transaction Data Profile Aggregation Test Database Software- test Software Product 21

22 Extracting Test data from IT Production
FUNC-20 Transaction Monitoring Data Capture User Interface Data Stream Dialog Recording Program Program Transaction Logging Prod. Data Base Trans. Log- File Test Data- base

23 Test Case Recording Transaction Order  Positions (n) Data entry
FUNC-21 Transaction Order  Positions (n) Data entry Trans = ORDER OrderNr = 101 Customer = Smith Position (1) Pos_Nr = ArticleNr = Amount = 3 Recording Transaction Store Test Cases Replay Production Program Test- data Batch Dialog Simulator 23

24 Operational Profile as Feedback Loop
TEST FUNC-22 Software-Evolution New Requirements Reusable Software Production Process Prototype Test Profile Product Test Process

25 Functional Test Coverage
Test Goals User Guide Requirement Specification Usage Profile Coverage of all defined Usages Coverage of all specified Requirements Coverage of all previously used Functions

26 Test the Business Rules of an Order Entry System
FUNC-24 Objects Actions PreConditions Customer_Order reject accept if Customer is unknown or Customer Credit is bad if Customer is known and Customer Credit is good Order_Position fulfill reject postpone if Article is on stock and AmountonStock > OrderedAmount if Article is not on stock If AmountonStock not > OrderedAmount Delivery_Notice create if Order-Position is fulfilled Back_Order if Order_Position is postponed Invoice_Position if Order_Position is fulfilled Article change if AmountonStock > OrderedAmount Supply_Position if AmountonStock < MinimumLevel Supplier select if SupplierPrice = Minimum(SupplierPrices) Supply_Order write if Supplier is selected and Suppy_Position exits


Download ppt "Functional Testing Testing against the Requirements"

Similar presentations


Ads by Google