Software Testing · Software Testing (As per the Syllabus 2013-14 of Mumbai University for B.Sc....

12

Transcript of Software Testing · Software Testing (As per the Syllabus 2013-14 of Mumbai University for B.Sc....

Software Testing(As per the Syllabus 2013-14 of Mumbai University for B.Sc. – IT, Semester V)

Mr. Arvind Harendra SinghM.Sc. (Computer Science),

Assistant Professor,Chandraban Sharma College of Arts, Science and Commerce,

Powai.

Ms. Nabila Nawaz KaziM.Sc. (Information Technology),

Assistant Professor,S.M. Shetty College of Science, Commerce and Management Studies,

Powai.

MUMBAI NEW DELHI NAGPUR BENGALURU HYDERABAD CHENNAI PUNELUCKNOW AHMEDABAD ERNAKULAM BHUBANESWAR KOLKATA

© AuthorsNo part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by anymeans, electronic, mechanical, photocopying, recording and/or otherwise without the prior written permission of thepublisher.

First Edition : 2016

Published by : Mrs. Meena Pandey for Himalaya Publishing House Pvt. Ltd.,“Ramdoot”, Dr. Bhalerao Marg, Girgaon, Mumbai - 400 004.Phone: 022-23860170/23863863, Fax: 022-23877178E-mail: [email protected]; Website: www.himpub.com

Branch Offices :New Delhi : “Pooja Apartments”, 4-B, Murari Lal Street, Ansari Road, Darya Ganj,

New Delhi - 110 002. Phone: 011-23270392, 23278631; Fax: 011-23256286Nagpur : Kundanlal Chandak Industrial Estate, Ghat Road, Nagpur - 440 018.

Phone: 0712-2738731, 3296733; Telefax: 0712-2721216

Bengaluru : Plot No. 91-33, 2nd Main Road Seshadripuram, Behind Nataraja Theatre,Bengaluru-560020. Phone: 08041138821, 9379847017, 9379847005.Phone: 080-22286611, 22385461, 4113 8821, 22281541

Hyderabad : No. 3-4-184, Lingampally, Besides Raghavendra Swamy Matham, Kachiguda,Hyderabad - 500 027. Phone: 040-27560041, 27550139

Chennai : New-20, Old-59, Thirumalai Pillai Road, T. Nagar, Chennai - 600 017.Mobile: 9380460419

Pune : First Floor, "Laksha" Apartment, No. 527, Mehunpura, Shaniwarpeth(Near Prabhat Theatre), Pune - 411 030. Phone: 020-24496323/24496333;Mobile: 09370579333

Lucknow : House No 731, Shekhupura Colony, Near B.D. Convent School, Aliganj,Lucknow - 226 022. Phone: 0522-4012353; Mobile: 09307501549

Ahmedabad : 114, “SHAIL”, 1st Floor, Opp. Madhu Sudan House, C.G. Road, Navrang Pura,Ahmedabad - 380 009. Phone: 079-26560126; Mobile: 09377088847

Ernakulam : 39/176 (New No: 60/251) 1st Floor, Karikkamuri Road, Ernakulam,Kochi – 682011. Phone: 0484-2378012, 2378016 Mobile: 09387122121

Bhubaneswar : 5 Station Square, Bhubaneswar - 751 001 (Odisha).Phone: 0674-2532129, Mobile: 09338746007

Kolkata : 108/4, Beliaghata Main Road, Near ID Hospital, Opp. SBI Bank,Kolkata - 700 010, Phone: 033-32449649, Mobile: 7439040301

DTP by : RakhiPrinted at : Rose Fine Art, Mumbai. On behalf of HPH.

Preface

It gives us a immense pleasure to introduce our First Edition of book on “Software Testing”strictly based on the revised syllabus of Mumbai University. The book is written in a user-friendlylanguage to make it easy and effortless for the students to seize the subject knowledge rapidly.

We are thankful to our Principal, Vice-Principal, Co-ordinator, Colleagues, Students, Friends andFamily members for their constant encouragement, inspiration and support they have extendedtowards us. We sincerely express our special thanks to S.K. Srivastava and entire staff ofM/s Himalaya Publishing House Pvt. Ltd. for their efforts.

As this being a theoretical book, there is always a extent for enhancement. We value all yourfeedback and will see to it that they are implemented in later versions. For any suggestion or querieson this book, please feel free to mail us on [email protected] /[email protected].

Authors

SyllabusSubject: Software Testing

Course Code: USIT503Class: B.Sc. (Information Technology) Semester – V

Unit Name of the Topic No. ofLectures

Unit – I Fundamentals of TestingNecessity of testing, What is it? Testing principles,Fundamental test process, The psychology of testing

10

Unit – II Testing throughout the Software Life CycleSoftware development models, Test levels, Test types: Thetargets of testing, Maintenance testing

10

Unit – III Static TechniquesReviews and the test process, Review process, Staticanalysis by tools

10

Unit – IV Test Design TechniquesIdentifying test conditions and designing test cases,Categories of test design techniques, Specification-based orblack-box techniques, Structure-based or white-boxtechniques, Experience-based techniques

10

Unit – V Test ManagementTest organization, Test plans, Estimates and strategies, Testprogress monitoring and control, Configuration management,Risk and testing, Incident management

10

Unit – VI Tool Support for TestingTypes of test tool, Effective use of tools: Potential benefitsand risks, Introducing a tool into an organization

10

Question Paper PatternMax. Marks: 75 Time: 2½ Hrs.Instructions:

1. All questions are compulsory.2. Attempt any TWO sub-questions from each question.3. Each sub-question is of 5 marks.

Q.1 Answer any TWO of the following: [10](a) From Unit 1(b)(c)(d)

Q.2 Answer any TWO of the following: [10](a) From Unit 2(b)(c)(d)

Q.3 Answer any TWO of the following: [10](a) From Unit 3(b)(c)(d)

Q.4 Answer any TWO of the following: [10](a) From Unit 4(b)(c)(d)

Q.5 Answer any TWO of the following: [10](a) From Unit 5(b)(c)(d)

Q.6 Answer any TWO of the following: [10](a) From Unit 6(b)(c)(d)

Q.7 Answer any THREE of the following: [15](a) From Unit 1(b) From Unit 2(c) From Unit 3(d) From Unit 4(e) From Unit 5(f) From Unit 6

Contents

Sr. No. Name Page No.

1 Fundamentals of Testing 1 – 5

2 Testing throughout the Software Life Cycle 6 – 29

3 Static Techniques 30 – 37

4 Test Design Techniques 38 – 59

5 Test Management 60 – 82

6 Tool Support for Testing 83 – 99

Practical Manual 100 – 143

Question Paper 144 – 145

Chapter 1

Structure: What is Software Testing? Necessity of Testing Principles of Testing Fundamental Test Process The Psychology of Testing

What is Software Testing?Software testing is a process of executing a program or application with the intent of finding the

software bugs.

It can also be stated as the process of validating and verifying that a software program orapplication or product:

Meets the business and technical requirements that guided it’s design and development Works as expected Can be implemented with the same characteristic.

Necessity of TestingThere are several reasons which clearly tells us as to why Software Testing is important and what

are the major things that we should consider while testing of any product or application.

Software testing is very important because of the following reasons:

1. Software testing is really required to point out the defects and errors that were made duringthe developmental phases.

2. It’s essential since it makes sure of the customer’s reliability and their satisfaction in theapplication.

3. It is very important to ensure the quality of the product. Quality product delivered to thecustomers helps in gaining their confidence.

4. Testing is necessary in order to provide the facilities to the customers like the delivery ofhigh quality product or software application which requires lower maintenance cost andhence results into more accurate, consistent and reliable results.

Fundamentals of Testing

2 Software Testing

5. Testing is required for an effective performance of software application or product.6. It’s important to ensure that the application should not result into any failures because it can

be very expensive in the future or in the later stages of the development.7. It’s required to stay in the business.

Principles of TestingThere are seven principles of testing. They are as follows:

1. Testing shows presence of defects: Testing an application can only reveal that one or moredefects exist in the application, however, testing alone cannot prove that the application iserror-free. Therefore, it is important to design test cases which find as many defects aspossible.

2. Exhaustive testing is impossible: Unless the application under test (UAT) has a verysimple logical structure and limited input, it is not possible to test all possible combinationsof data and scenarios. For this reason, risk and priorities are used to concentrate on the mostimportant aspects to test.

3. Early Testing: The sooner we start the testing activities the better we can utilize theavailable time. As soon as the initial products, such the requirement or design documents areavailable, we can start testing.Another important point about early testing is that when defects are found earlier in the life-cycle, they are much easier and cheaper to fix.

4. Defect Clustering: During testing, it can be observed that most of the reported defects arerelated to small number of modules within a system. i.e. small number of modules containmost of the defects in the system. This is the application of the Pareto Principle to SoftwareTesting: approximately 80% of the problems are found in 20% of the modules.

5. Pesticide Paradox: If the same kinds of tests are repeated again and again, eventually thesame set of test cases will no longer be able to find any new bugs. To overcome this“Pesticide Paradox”, it is really very important to review the test cases regularly and newand different tests need to be written to exercise different parts of the software or system topotentially find more defects.

6. Testing is Context Depending: Different methodologies, techniques and types of testing isrelated to the type and nature of the application. For example, a software application in amedical device needs more testing than games software.

7. Absence of Errors Fallacy: Just because testing didn’t find any defects in the software, itdoesn’t mean that the software is ready to be shipped. Were the executed tests reallydesigned to catch the most defects? Or were they designed to see if the software matched theuser’s requirements? There are many other factors to be considered before making adecision to ship the software.

3Fundamentals of Testing

Fundamental Test ProcessThe Fundamental of Test Process are:

Test Planning and Control Test Analysis and Design Test Implementation and Execution Evaluating Exit Criteria and Reporting Test Closure Activities

Test Planning and ControlTest Planning is a Fundamental Test Process which defines the objective and goal of testing

process. Using requirement specification test plan will make more detailed. It is continuous processand performed in all life cycles.

Deciding the scope and risk of testing. Deciding the overall approach of testing. Scheduling test analysis and design process. Assigning resources to different activities.

Test Analysis and DesignTest Analysis and Design is a Fundamental Test Process which creates test conditions & test

cases. In this process performed major tasks like reviewing the test basis, identifying the testconditions based on analysis of test items, writing test cases, identifying necessary test data to supportthe test conditions and test cases, designing the test environment.

Test Implementation and ExecutionTest implementation and execution is a Fundamental Test Process in which actual work is done.

In this process executing test cases with test data.

Creating test suits from test executions. Checking test environments, updating trace-ability between test basis and test cases. Executing test procedures using test execution tools. Checking actual result with expected results. Reporting errors & creating incident reports.

Evaluating Exit Criteria and ReportingEvaluating exit criteria is a process, defining when to stop testing. It depends on coverage of code,

functionality or risk. Basically it also depends on business risk, cost and time.

4 Software Testing

Test Closure ActivitiesThe last process involves test closure activities in the fundamental test process. In this process

collect data from completed test process and test wares.

Ensure that deliverable have been delivered or not. Closing incident report. Documenting all the systems. Archiving all the test-ware, test environment and infrastructure.

The Psychology of TestingThe psychology of testing consists of the following:

The comparison of the mindset of the tester and the developer. The balance between self-testing and independent testing. There should be clear and courteous communication and feedback on defects between tester

and developer.

Comparison of the mindset of the tester and developerThe testing and reviewing of the applications are different from the analyzing and developing of

it. By this, we mean to say that if we are building or developing applications we are working positivelyto solve the problems during the development process and to make the product according to the userspecification. However, while testing or reviewing a product we are looking for the defects or failuresin the product. Thus, building the software requires a different mindset from testing the software.

The balance between self-testing and independent-testingThe comparison made on the mindset of the tester and the developer in the above article is just to

compare the two different perspectives. It does not mean that the tester cannot be a programmer, orthat a programmer cannot be the tester, although they often are separate roles. In fact, theprogrammers are the testers. They always test their component which they built. While testing theirown code they find many problems so the programmers, architect and the developers always test theirown code before giving it to anyone. However we all know that it is difficult to find our own mistakes.So, programmers, architects, business analysts depend on others to help test their work. This otherperson might be some other Developer from the same team or the Testing Specialists or ProfessionalTesters. Giving applications to the testing specialists or professional testers allows an independent testof the system.

This degree of independence avoids author bias and is often more effective at findingdefects and failures.

There are several levels of independence in software testing which are listed here from the lowestlevel of independence to the highest:

(i) Tests by the person who wrote the item.(ii) Tests by another person within the same team, like another programmer.

(iii) Tests by the person from some different group such as an independent test team.

5Fundamentals of Testing

(iv) Tests by a person from a different organization or company, such as outsourced testing orcertification by an external body.

Clear and courteous communication and feedback on defects between tester and developerWe all make mistakes and we sometimes get annoyed and upset or depressed when someone

points them out. So, when as testers we run a test which is a good test from our viewpoint because wefound the defects and failures in the software. But at the same time we need to be very careful as tohow we react or report the defects and failures of the programmers. We are pleased because we founda good bug but how will the requirement analyst, the designer, developer, project manager andcustomer react.

The people who build the application may react defensively and take this reported defect aspersonal criticism.

The project manager may be annoyed with everyone for holding up the project. The customer may lose confidence in the product because he can see defects.

Because testing can be seen as destructive activity we need to take care while reporting ourdefects and failures as objectively and politely as possible.

The balance between self-testing and independent testing.

Questions1. What is defect? What are its causes? When do they arise? What are the cost of finding

defects?2. What is Quality? Explain Quality View Points for producing & buying software.3. Explain Principles of Testing.4. Explain Fundamental Test Process.5. Write a short note on Psychology of Testing.6. Define the terms: (i) Risk (ii) Defect (iii) Failure (iv) Error (v) Quality.7. Compare test policy and test strategy.8. What are the causes of software defects?9. Explain test analysis & design activities and test implementation and execution process in

detail.10. What is the cost of finding defects?