📄 Page
1
Introduction to Software Testing A Practical Guide to Testing, Design, Automation, and Execution — Panagiotis Leloudas
📄 Page
2
Introduction to Software Testing A Practical Guide to Testing, Design, Automation, and Execution Panagiotis Leloudas
📄 Page
3
Introduction to Software Testing: A Practical Guide to Testing, Design, Automation, and Execution ISBN-13 (electronic): 978-1-4842-9514-4ISBN-13 (pbk): 978-1-4842-9513-7 Copyright © 2023 by Panagiotis Leloudas This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein. Managing Director, Apress Media LLC: Welmoed Spahr Acquisitions Editor: Divya Modi Development Editor: James Markham Coordinating Editor: Divya Modi Cover designed by eStudioCalamar Cover image by Freepik.com Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York, NY 10004, U.S.A. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation. For information on translations, please e-mail booktranslations@springernature.com; for reprint, paperback, or audio rights, please e-mail bookpermissions@springernature.com. Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales web page at www.apress.com/bulk-sales. Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub (https://github.com/Apress). For more detailed information, please visit www.apress.com/source-code. Printed on acid-free paper Panagiotis Leloudas Ilioupoli, Greece
📄 Page
5
v Table of Contents About the Author ���������������������������������������������������������������������������������xi About the Technical Reviewer �����������������������������������������������������������xiii Acknowledgments ������������������������������������������������������������������������������xv Introduction ��������������������������������������������������������������������������������������xvii Chapter 1: The Importance of Software Testing �����������������������������������1 Summary4 Chapter 2: Software Testing Types and Techniques������������������������������5 Functional Testing 5 Unit Testing 7 Integration Testing 9 System Testing 11 User Acceptance Testing 11 Nonfunctional Testing 13 Performance Testing 14 Security Testing 17 Usability Testing20 Compatibility Testing 21 Scalability Testing 22 Reliability Testing23 Availability Testing 24 Installability Testing 24
📄 Page
6
vi Maintainability Testing 26 Compliance Testing 27 Static Testing 29 Code Reviews 29 Requirement Reviews30 Design Reviews 31 Walk-Throughs 32 Inspections 33 Summary34 Chapter 3: Software Development Life Cycle ��������������������������������������35 Planning Phase 36 Requirements Gathering Phase 39 Design Phase 42 Development Phase 45 Deployment Phase 48 Maintenance Phase 51 The Role of Testing in the SDLC 54 Summary55 Chapter 4: Test Planning ���������������������������������������������������������������������57 Defining Testing Objectives 57 Determining the Scope of Testing 59 Selecting the Testing Approach 59 Identifying Testing Resources 61 Developing the Test Schedule 62 Defining Test Cases 63 Identifying Test Data 65 Table of ConTenTs
📄 Page
7
vii Defect Management Process 66 Stop Testing Criteria 67 Reviewing and Approving the Test Plan 67 Benefits of Test Planning68 Test Plan Document 69 Test Planning Tools and Techniques 71 Summary73 Chapter 5: Test Design Techniques �����������������������������������������������������75 Black-Box Testing 75 Equivalence Partitioning 78 Boundary Value Analysis 82 Decision Table Testing 84 State Transition Testing 88 Use-Case Testing 93 Pairwise Testing 95 Error Guessing 98 Exploratory Testing 100 Random Testing 103 Ad Hoc Testing 105 White-Box Testing 107 Statement Coverage 109 Branch Coverage 112 Path Coverage 115 Condition Coverage 118 Decision Coverage 121 Multiple Condition Coverage 123 Modified Condition/Decision Coverage 127 Table of ConTenTs
📄 Page
8
viii Loop Testing 130 Data Flow Testing 132 Static Testing 133 Summary135 Chapter 6: Test Execution �����������������������������������������������������������������137 Getting Started 137 Test Execution Process 138 Test Environment Setup 139 Defect Reporting and Retesting 141 Regression Testing 144 Test Case Status Reporting 146 Test Case Completion 148 Techniques and Tools Used in Test Execution 149 Quality Metrics 150 Defect Density 150 Test Coverage 151 Code Complexity 152 Code Maintainability 152 Fault Slip Through 153 Coding Standards 154 Code Duplication 155 Dead Code 156 Lines of Code 157 Fan-Out 158 Compiler Warnings 159 Summary159 Table of ConTenTs
📄 Page
9
ix Chapter 7: Test Automation ��������������������������������������������������������������161 Benefits of Test Automation 161 Record and Playback Tools 162 Scripting Tools 163 Hybrid Tools 164 Frameworks 165 Automated Testing Tools 167 Automated Test Scripts 169 Summary171 Chapter 8: Testing in Agile Environment ������������������������������������������173 Agile Testing Principles 174 Agile Testing Quadrants 175 Test-Driven Development 177 Behavior-Driven Development 179 Acceptance Test-Driven Development 181 Continuous Integration and Continuous Delivery 183 Test Automation in Agile 184 Agile Testing Best Practices 186 Summary187 Chapter 9: Challenges and Solutions in Software Testing ����������������189 Lack of Clear Requirements 189 Impact of Lack of Clear Requirements on Testing 190 Mitigating the Impact of Lack of Clear Requirements 190 Time Constraints 191 Impact of Time Constraints on Software Testing 191 Strategies for Managing Time Constraints in Testing 192 Table of ConTenTs
📄 Page
10
x Lack of Skilled Resources 193 Impact of Lack of Skilled Resources on Software Testing 193 Strategies for Managing Lack of Skilled Resources in Testing 194 Automation Challenges 195 Common Automation Challenges195 Strategies for Addressing Automation Challenges 196 Communication and Collaboration 197 Change Management 197 Testing Across Platforms 199 Future of Software Testing 200 Risk-Based Testing 202 Summary204 Afterword ������������������������������������������������������������������������������������������205 Index �������������������������������������������������������������������������������������������������207 Table of ConTenTs
📄 Page
11
xi About the Author Panagiotis Leloudas is a software quality assurance engineer with more than 10 years of working experience in the industry. He holds several ISTQB certifications and is an expert in testing principles, methodologies, and techniques. He decided to write this quick guide to software testing because he needed a go-to document for all the decisions he had to make every day on the job and there wasn’t one. He tried to write down everything that he would have liked to know when he started his career.
📄 Page
12
xiii About the Technical Reviewer Sourabh Mishra is an entrepreneur, developer, speaker, author, corporate trainer, and animator. He is passionate about Microsoft technologies and a true .NET warrior. Sourabh has loved computers from childhood and started his career when he was just 15 years old. His programming experience includes C/C++, ASP.NET, C#, VB .NET, WCF, SQL Server, Entity Framework, MVC, Web API, Azure, jQuery, Highcharts, and Angular. Sourabh has been awarded Most Valuable Professional (MVP) status. He has the zeal to learn new technologies, sharing his knowledge on several online community forums. He is a founder of IECE Digital and Sourabh Mishra Notes, an online knowledge-sharing platform where people can learn new technologies.
📄 Page
13
xv Acknowledgments Writing a book is a significant undertaking, and I couldn’t have done it without the support and assistance of many people along the way. I want to express my gratitude to everyone who contributed to the creation of this book and helped me throughout the process. First and foremost, I want to thank my family for their unwavering support, encouragement, and patience during the many months of writing and editing. Your love and support mean the world to me, and I couldn’t have done this without you. I also want to thank my editors, Divya Modi and James Markham, for their insightful feedback, guidance, and support throughout the writing process. Your expertise and attention to detail were invaluable in shaping this book into its final form. I am grateful to Apress Media LLC for believing in this project and providing the resources necessary to bring it to fruition. I am indebted to the many experts, researchers, and consultants who generously shared their knowledge, insights, and expertise to help me with my research. Your contributions have added depth and richness to this book. Finally, I want to thank my readers for their interest in this book and for taking the time to read it. Your support and feedback mean the world to me, and I hope this book can make a positive difference in your life. Thank you all for your support, encouragement, and contributions to this book. I am forever grateful.
📄 Page
14
xvii Introduction A collection of notes, thoughts, and experiences written down to be shared with the world: this is how I see the creation of this book. It is not meant to be the ultimate truth about software testing; there is no such a thing after all. I have taken several courses about software testing from different organizations, in numerous countries, and I have spent weeks studying testing material, but most of my knowledge comes from trial and error in the industry. It is true that in the end you learn only what you practice. This book takes you on a journey around the software testing world, covering the basic principles and techniques and showing examples of how to apply them. Software testing is a safeguard of the quality of a software product, and a tester is responsible for reporting on the quality status. Keep in mind that the quality of the product is not the sole responsibility of a tester; rather, it’s a collective effort from every individual in the organization. A chain is only as strong as its weakest link. Different types of testing are applicable to every phase of the software development life cycle; of course, the priorities and the risks are not the same in all the products. Testing is all about identifying those risks and setting up a mitigation plan by executing the necessary tests and analyzing the results. In this book, I will demonstrate some of the most important software testing types and techniques that exist and how to apply them. You will find out what testing activities take place during every phase of software development, how to plan the testing activities, how to design the test cases, how to execute them, and how to report defects and the status of your activities. It is meant to be easy to understand for everyone, even with only the slightest technical background or involvement in a product. I hope you will enjoy the process and pick up a thing or two!
📄 Page
15
1© Panagiotis Leloudas 2023 P. Leloudas, Introduction to Software Testing CHAPTER 1 The Importance of Software Testing Software testing is a crucial part of the software development process. It is the process of evaluating a software system or application to find defects, errors, or bugs, and verifying that it meets its intended requirements and functions correctly. Software testing is essential because it ensures that the software performs as expected, meets user needs, and is reliable and efficient. Testing is not a one-time event, but rather a continuous process that begins in the early stages of development and continues through the software’s life cycle. The process involves planning, designing, executing, and evaluating tests to identify and fix issues and to improve the quality of the software. There are various types of software testing, each with a unique focus and objective. Some of the common types include unit testing, integration testing, system testing, acceptance testing, regression testing, performance testing, and security testing. Each type of testing has a specific purpose and is conducted at different stages of the software development life cycle. One common misconception about software testing is that it is just about finding defects or errors in software. While detecting defects is an essential part of software testing, it is not the only goal. Testing is also about verifying that the software meets user requirements, is easy to use, and performs as expected. Testing also involves ensuring that the software is scalable, secure, and efficient.
📄 Page
16
2 Another misconception is that testing can be eliminated by writing perfect code or using the right tools. However, testing is an integral part of software development, and there is no way to guarantee that software is completely free of errors. No matter how skilled the development team is or how advanced the tools and technologies used, there is always a possibility of errors or unexpected outcomes. Therefore, testing is essential to identify and fix issues early in the development process before they become major problems. Black-box testing is a testing technique that examines the functionality of an application without knowing its internal code structure. The tester focuses on the inputs and outputs of the system and tests the application based on the specifications or requirements. The goal of black-box testing is to identify defects in the functionality, usability, and performance of the application. White-box testing, on the other hand, is a testing technique that examines the internal structure of the application. The tester focuses on the application’s code structure, internal logic, and algorithms to test the application. The goal of white-box testing is to identify defects in the code structure and ensure that the application functions correctly. Gray-box testing is a combination of black-box and white-box testing. The tester has some knowledge of the internal code structure, but not full access. The goal of gray-box testing is to identify defects in the code structure and ensure that the application functions correctly. Exploratory testing is a testing technique that involves testing the software without predefined test cases or scripts. The tester explores the software and tests it based on their intuition and experience. The goal of exploratory testing is to identify defects that may not be found using traditional testing techniques. In addition to testing the software’s functionality, it is also essential to test nonfunctional aspects, such as performance, security, and usability. These types of testing ensure that the software meets its nonfunctional requirements and provides a positive user experience. Chapter 1 the ImportanCe of Software teStIng
📄 Page
17
3 Software testing is an ongoing process that continues throughout the software’s life cycle. It is essential to conduct regular testing, even after the software has been released to production, to ensure that it continues to function correctly and meets the users’ needs. This is known as maintenance testing. This book will provide a simple overview of the testing activities, tools, and techniques. By the end of it, you will have all the basic knowledge you need in a day as a tester. I have tried to assemble all the knowledge I have accumulated so far into a small practical guide on how software testing is. The purpose of this book is not to enforce processes and tools in your organization, but to give you some ideas and best practices you might find useful in your daily activities. It is the responsibility of the tester to report on the quality of the product, but the quality of a company relies on every single individual. Software quality is the responsibility of everyone involved in the software development process, including developers, testers, project managers, business analysts, and other stakeholders. Here are some ways that each individual can contribute to software quality in a company. Developers play a critical role in ensuring software quality by writing high-quality, well-designed, and maintainable code. They can also contribute to software quality by adhering to coding standards, performing code reviews, and writing automated tests. Testers play a crucial role in ensuring software quality by designing and executing test plans and test cases to verify that software products meet the requirements and expectations of end users. They can also provide feedback to development teams to help improve the quality of the code. Product owners are responsible for defining and prioritizing product requirements. They can contribute to software quality by ensuring that requirements are clear, concise, and testable, and that they meet the needs of end users. Chapter 1 the ImportanCe of Software teStIng
📄 Page
18
4 Project managers are responsible for managing project timelines, resources, and budgets. They can contribute to software quality by ensuring that projects are adequately resourced, that timelines are realistic, and that projects are well-planned and executed. Business analysts can contribute to software quality by ensuring that the business requirements are clear, complete, and testable, and that testing teams have the information they need to design effective test cases. They can also validate the requirements with stakeholders and subject- matter experts to identify any gaps or inconsistencies in the requirements early in the development process. User experience designers are responsible for ensuring that software products are user-friendly and meet the needs of end users. They can contribute to software quality by conducting user research, designing intuitive user interfaces, and ensuring that products meet accessibility and usability standards. Operations teams are responsible for deploying and maintaining software products. They can contribute to software quality by ensuring that software is deployed in a reliable way. Technical writers can contribute to software quality by ensuring that user documentation is clear, concise, and easy to understand. This can help to reduce the risk of user errors and improve the overall user experience. Summary To summarize, software quality is a collective effort, and the responsibilities are distributed among the various members of a company. There are plenty of software testing types and techniques for the core testing team of a project, and the next chapter will dive into the details of each and every one. Chapter 1 the ImportanCe of Software teStIng
📄 Page
19
5 CHAPTER 2 Software Testing Types and Techniques Software testing is a complex process that involves various types and techniques to ensure that the software is working correctly and meets its intended requirements. In this chapter, we will discuss the different types of software testing and the techniques used in each type, starting with functional testing and the four levels it involves. We will continue with nonfunctional testing, which can include performance testing, compliance testing, and all the different types of -ility testing (usability, compatibility, availability, etc.). After that, we will see the benefits of static testing, where we can detect potential defects just by carefully examining the code without even executing it. Functional Testing This type of testing is performed to validate that the software is working as expected and meets the user’s requirements. The primary focus is on the software’s functionality and includes various levels of testing such as unit testing, integration testing, system testing, and acceptance testing. These levels are widely known as the testing pyramid, a concept introduced by Mike Cohn. © Panagiotis Leloudas 2023 P. Leloudas, Introduction to Software Testing
📄 Page
20
6 The lower we go on the testing pyramid (Figure 2-1), the faster and more isolated the tests are. On the contrary, as we go higher on the testing pyramid, the tests become slower, and more components are integrated. Figure 2-1. The testing pyramid Unit testing involves testing individual units or components of the software. The objective is to validate that each unit functions correctly and meets its intended requirements. Integration testing involves testing the integration of individual units or components to ensure that they work together correctly. System testing involves testing the entire system to ensure that it meets the user’s requirements and functions correctly. User acceptance testing involves testing the software from the user’s perspective to ensure that it meets the user’s expectations and requirements. Chapter 2 Software teSting typeS and teChniqueS