Presentation is loading. Please wait.

Presentation is loading. Please wait.

Defect Example : The Coin Problem

Similar presentations


Presentation on theme: "Defect Example : The Coin Problem"— Presentation transcript:

1 Defect Example : The Coin Problem

2 Specification for the program calculate_coin_value
This program calculates the total rupees value for a set of coins. The user inputs the amount of 25p, 50p and 1rs coins. There are size different denominations of coins. The program outputs the total rupees and paise value of the coins to the user. Input : number_of_coins is an integer Output : number_of_rupees is an integer number_of_paise is an integer IT SOFTWARE TESTING - Defect Examples

3 Design Description for the Coin Problem
Design Description for Program calculate_coin_values Program calculate_coin_values number_of_coins is integer total_coin_value is integer number_of_rupees is integer number_of_paise is integer coin_values is array of six integers representing each coin value in paise initialized to: 1,5,10,25,25,100 begin initialize total_coin_value to zero initialize loop_counter to one while loop_counter is less than six output “enter number of coins” read (number_of_coins ) total_coin_value = total_coin_value + number_of_coins * coin_value[loop_counter] increment loop_counter end number_rupees = total_coin_value/100 number_of_paise = total_coin_value – 100 * number_of_rupees output (number_of_rupees, number_of_paise) IT SOFTWARE TESTING - Defect Examples

4 IT6004 - SOFTWARE TESTING - Defect Examples
/*********************************************************************************************************************** program calculate_coin_values calculates the dollar and cents value of a set of coins of different dominations input by the user denominations are pennies, nickels, dimes, quarters, half dollars, and dollars ***********************************************************************************************************************/ main () { int total_coin_value; int number_of_coins = 0; int number_of_rupees = 0; int number_of-paise = 0; int coin_values = {1,5,10,25,25,100}; int i = 1; while ( i < 6) printf("input number of coins\n"); scanf ("%d", number_of_coins); total_coin_value = total_coin_value + (number_of_coins * coin_value{i]); } i = i + 1; number_of_rupees = total_coin_value/100; number_of_paise = total_coin_value - (100 * number_of_rupees); printf("%d\n", number_of_rupees); printf("%d\n", number_of-paise); /**********************************************************************************************************************/ IT SOFTWARE TESTING - Defect Examples

5 IT6004 - SOFTWARE TESTING - Defect Examples
1. Requirement Specification Defects Precondition: number_of_coins >= 0 Post Condition: number_of_dollars, number_of_cents >= 0. IT SOFTWARE TESTING - Defect Examples

6 IT6004 - SOFTWARE TESTING - Defect Examples
2. Design Defects in the Coin Problem Control, logic, and sequencing defects. The defect in this subclass arises from an incorrect “while” loop condition (should be less than or equal to six) Algorithmic, and processing defects. These arise from the lack of error checks for incorrect and/or invalid inputs, lack of a path where users can correct erroneous inputs, lack of a path for recovery from input errors. Data defects. This defect relates to an incorrect value for one of the elements of the integer array, coin_values, which should be 25, 50, 100. External interface description defects. These are defects arising from the absence of input messages or prompts that introduce the program to the user and request inputs. IT SOFTWARE TESTING - Defect Examples

7 IT6004 - SOFTWARE TESTING - Defect Examples
3. Coding Defects in the Coin Problem Control, logic, and sequence defects. These include the loop variable increment step which is out of the scope of the loop. Note that incorrect loop condition (i<6) is carried over from design and should be counted as a design defect. Algorithmic and processing defects. The division operator may cause problems if negative values are divided, although this problem could be eliminated with an input check. Data Flow defects. The variable total_coin_value is not initialized. It is used before it is defined. Data Defects. The error in initializing the array coin_values is carried over from design and should be counted as a design defect. External Hardware, Software Interface Defects. The call to the external function “scanf” is incorrect. The address of the variable must be provided. Code Documentation Defects. The documentation that accompanies this code is incomplete and ambiguous. It reflects the deficiencies in the external interface description and other defects that occurred during specification and design. IT SOFTWARE TESTING - Defect Examples

8 Example scenario that caused a bug:
Lets assume in your application under test you want to create a new user with user information, for that you need to logon into the application and navigate to USERS menu > New User, then enter all the details in the ‘User form’ like, First Name, Last Name, Age, Address, Phone etc. Once you enter all these information, you need to click on ‘SAVE’ button in order to save the user. Now you can see a success message saying, “New User has been created successfully”. But when you entered into your application by logging in and navigated to USERS menu > New user, entered all the required information to create new user and clicked on SAVE button. BANG! The application crashed and you got one error page on screen. (Capture this error message window and save as a Microsoft paint file) Now this is the bug scenario and you would like to report this as a BUG in your bug-tracking tool. IT SOFTWARE TESTING - Defect Examples

9 IT6004 - SOFTWARE TESTING - Defect Examples

10 IT6004 - SOFTWARE TESTING - Defect Examples
SAMPLE BUG REPORT: Bug Name: Application crash on clicking the SAVE button while creating a new user. Bug ID: (It will be automatically created by the BUG Tracking tool once you save this bug) Area Path: USERS menu > New Users Build Number: Version Number Severity: HIGH (High/Medium/Low) or 1 Priority: HIGH (High/Medium/Low) or 1 Assigned to: Developer-X Reported By: Your Name Reported On: Date Reason: Defect Status: New/Open/Active (Depends on the Tool you are using) Environment: Windows 2003/SQL Server 2005 Description: Application crash on clicking the SAVE button while creating a new user, hence unable to create a new user in the application. IT SOFTWARE TESTING - Defect Examples

11 IT6004 - SOFTWARE TESTING - Defect Examples
Steps To Reproduce: 1) Logon into the application 2) Navigate to the Users Menu > New User 3) Filled all the user information fields 4) Clicked on ‘Save’ button 5) Seen an error page “ORA1090 Exception: Insert values Error…” 6) See the attached logs for more information (Attach more logs related to bug..IF any) 7) And also see the attached screenshot of the error page. Expected result: On clicking SAVE button, should be prompted to a success message “New User has been created successfully”. IT SOFTWARE TESTING - Defect Examples

12 IT6004 - SOFTWARE TESTING - Defect Examples

13 IT6004 - SOFTWARE TESTING - Defect Examples


Download ppt "Defect Example : The Coin Problem"

Similar presentations


Ads by Google