72
© 2013 QuEST Global, Inc. Confidential 1 Introduction Software Testing Computer programs are designed and developed by human beings and hence are prone to errors. Unchecked Software, they can lead to a lot of problems, including social implications. Testing the software becomes an essential part of the software development lifecycle. Carrying out the testing activities for projects has to be practiced with proper planning and must be implemented correctly.

Software Testing

Embed Size (px)

DESCRIPTION

Software testing basic and advanced features. with examples of white box testing and black box testing.

Citation preview

Slide 1

Introduction Software Testing Computer programs are designed and developed by human beings and hence are prone to errors.

Unchecked Software, they can lead to a lot of problems, including social implications.

Testing the software becomes an essential part of the software development lifecycle.

Carrying out the testing activities for projects has to be practiced with proper planning and must be implemented correctly.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#1

Basic Questions on Testing Why to test? Testing becomes absolutely essential to make sure the software works properly and does the work that it is meant to perform. Any working product which forms part of the software application has to be tested. Both data and programs must be tested.

How often to test? When a program (source code) is modified or newly developed, it has to be tested.

Who tests? Programmer, Tester and Customer.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#

Definition: Software Testing Software Testing is the process used to measure the quality of developed computer software. Software Testing means Finding an Errors in Software. Software Testing is stated as a process of Validating and Verifying that a Software program/application/product: meets the requirements that guided its design and development. works as expected. can be implemented with the same characteristics. satisfies the needs of stakeholders. 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#

TYPES OF TESTING MANUAL TESTING Manual testing is the process of manually testing software for defects. It requires a tester to play the role of an end user.

Testing that part of software testing that requires human input, analysis, or evaluation.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#

TYPES OF TESTING AUTOMATION TESTING Testing application with the help of tools.

Test automation is the use of software to control the execution of tests, the comparison of actual outcomes to predicted outcomes, the setting up of test preconditions, and other test control and test reporting functions .

The Test Scripts are reusable, the process ensures time Saving, and mainly done when we have monotonous or repetitive task.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#

Topics Covered Software Problems and Objectives of Testing Quality Principles Software Development Life Cycle Software Life Cycle Models Testing Methodologies Software Testing Life Cycle Defect / Bug Life Cycle Test Automation Testing Certifications

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#

Most Common Software Problems And Objectives of Testing Common Software Problems Incorrect Coding / Implementation of business rules. Confusing and misleading data. Incorrect File handling.

Objectives of Testing Executing a Program with the intent of finding an Error. To check if the System meets Requirements. A good test case is one that has a probability of finding an as yet undiscovered Error. A good test should neither be too Simple nor too Complex.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Objectives of a Software Tester To understand Application Requirements well. Finding bugs as early as possible and make they get fixed. Study the functionality in detail to find where the bugs are likely to occur. Create the Test cases in such a way that testing is done to uncover the hidden bugs. Ensuring that the Software is Usable and Reliable. 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#QUALITY PRINCIPLES Quality the most important factor affecting an Organizations Long-term performance. Quality the way to achieve improved productivity and competitiveness in an Organization. Quality saves. It does not cost. Quality is the solution to the problem, not a problem. 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Quality Assurance Vs. Quality Control Quality Assurance (QA) A planned and systematic set of activities necessary to provide confidence that requirements are properly established, products and services conform to specified requirements.

QA is the responsibility for entire team.

Quality Control (QC) The process by which product quality is compared with applicable standards; and action taken when non-conformance is detected. QC is the responsibility for Testers.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Verification and Validation Verification process confirms that the Software meets its Technical Specifications. It involves Reviews and meeting to evaluate documents , plans, code requirements.

Validation process confirms that the Software meets the Business requirements. It involves actual testing and takes place after Verifications are completed.

Verification and Validation process continue in a Cycle till the Software becomes defects free.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Software Development Life Cycle (SDLC) SDLC Software Development Life Cycle is step by step procedure to develop a software application.

The Different phases of SDLC are :Requirement CollectionFeasibility StudyDesignCodingTestingInstallationMaintenance 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Different Stages in SDLC Process of SDLC phases Business Analyst (collects Requirement) Finance Dept, HR, BA, Architect (Cost, Time, Resources, Project Doable or Not) H.L.D (Architect) L.L.D (Sr. Developer) DeveloperTest Engineer (Application is stable or not)Installation EngineerREQUIREMENTS ANALYSIS DESIGN CODING TESTING IMPLEMENTATION MAINTENANCE 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Different Stages in SDLC REQUIREMENTS: Requirements are set of functionalities and constraints that the end-user expects from the system. The requirements are gathered from the end-user by consultation .

REQUIREMENT SPECIFICATION CRS [Customer requirement specification] SRS [Software requirement specification]

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Different Stages in SDLCCRSThis document will describe in detail , about what is expected out of the software product from the user's perspective.

The wordings of this document will be in the same tone that of a user . SRS This document will describe in detail about what is expected out of the software product from the user's perspective.

The wordings of this document will be in the same tone that of a developers which means software language.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Different Stages in SDLC ANALYSES: The requirements are analyzed for their validity and the possibility of incorporating the requirements in the system to be developed are studied.

Finally, a Requirement Specification document is created which serves the purpose of guideline for the next phase of the model.

DESIGN: TWO TYPES HLD: [High Level Design] Architecture of the project.

LLD: [Low Level Design] Designing the each & every model of project in detail.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Different Stages in SDLC CODING:Converting the pseudo code into a programming language in the specified platform.

TESTING:Verifying the functionalities of an project against requirements. INSTALLATION:Application has been installed at the clients place. MAINTENANCE:It generally refers to warranty period given by the company to the client for the application. 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Software Life Cycle Models WATERFALL MODEL

SPIRAL MODEL

PROTOTYPE MODEL

V-PROCESS MODEL

AGILE MODEL

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#V V Model

Validation(Testing)Verification(Review Process)CRSSRSH.L.DL.L.DCodingCustomerTest EngineerTest EngineerDeveloper 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#V-Shaped Steps Project and Requirements Planning: Allocate resources. Product Requirements and Specification Analysis: Complete specification of the software system. Architecture or High-Level Design: Defines how software functions fulfill the design. Detailed Design: Develop algorithms for each architectural component. Production, operation and maintenance: Provide for enhancement and corrections. System and acceptance testing: Check the entire software system in its environment. Integration and Testing: Check that modules interconnect correctly. Unit testing: Check that each module acts as expected. Coding: Transform algorithms into function specification.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Testing MethodologiesTypes Of Testing

White Box TestingBlack Box TestingGrey Box Testing(Unit Testing)(Test Engineer)

Unit Testing:It is small program which is written by the developers that in tern test the main program. 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Testing MethodologiesWhite Box TestingIt is the type of testing done by the developers where they testeach and every line of code written by them before handing overthe product to the test engineer.

Black Box TestingIt is type of testing done by the Test Engineer where they checkif the application is working according to the requirementsdocument.

White Box testingGenerally it is done by the Test Engineer who has knowledge Of both coding as well as testing.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Types of White Box TestingPath TestingIn this type developers test for the complete flow of the programs or path of the programs & total number of paths in the program.

Conditional TestingIn this type developers check if all the conditional statements written in the program are executed for both true as well as false conditions.

Loop Testing (Memory and Response Time)In this type developers check if all the looping conditions written in the program are executed for the complete number of cycles with these types developers also test the memory and response time w. r. t code.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#

How to do Testing and its Life cycle Testing Objectives:Testing is a process of executing software with the intent of finding errorsGood testing has a high probability of finding as-yet-undiscovered errorsSuccessful testing discovers unknown errorsIf did not find any errors, need to ask whether our testing approach is goodGoal of testing: given some code, uncover as many errors are possible

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#

How to do Testing and its Life cycle Major Testing Methods:Unit Testing Sanity Testing Functional TestingIntegration TestingUAT Testing System (End to End ) Testing Retesting Regression Testing Globalization Testing

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Unit and Sanity Testing Unit Testing Is a level of the Software Testing process where individual units/components of a Software/System are Tested. A unit is the smallest testable part of Software. It covers testing on a specific part of code perform by developers .

Sanity Testing /Smoke Testing Testing basic functionality of an application Or Critical features of an application. Its very basic level Testing done by QA after fixing some bug.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Black Box TestingTest the functionality of the application against requirement specification.

Types of black box testingFunctional TestingIntegration TestingSystem Testing

RequirementCodingFunctional TestingIntegration TestingSystem TestingWhite Box Testing 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Black Box TestingFunctional TestingTesting each and every component of an application of an application and each and every module independently is called as functional testing.For functional testing we require:Requirements, ApplicationPoints to remember while doing functional testing.Testing application with positive inputs first.Then we should do negative testing.Dont do Over testing /Exhaustive testing.Do not assume requirements by oneself, No assumptions.Under testing, if two components are same.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Black Box TestingIntegration TestingTesting the data flow or integration from one module to another module is Integration Testing.

Points to remember while doing Integration testing:Complete the functional testing on all the features first.

As an T.E, one should have complete knowledge of the modules and data flow between modules.

Do not do the Integration testing randomly, whereas pick each and every module and complete the data flow from that module to all other modules wherever the data flow is available. 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Black Box TestingSystem TestingTesting the end to end flow of an application is called as system testing.

In system testing the test environment is similar to product environment, similar w. r. t software, hardware, data.

To begin our testing one should have Required documents.Application should be installed on to the test server.Test URL should be given. 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#UAT and Exploratory TestingUser Acceptance Testing (UAT) The client will test it, in their place, in a near-real-time or simulated environment. AT is a type of testing done by engineers sitting in it division of customer place.

Exploratory Testing Checking application functionalities without document, Explore the application. Test Design and Test Execution at the same time.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Difference of Re test and Regression TestingRe-test Testing only certain part of an application again and not considering how it will effect in the other part or in the whole application. Testing the bug again once the code is fixed to ensure that the particular functionality is working fine.

Regression Testing Testing the application after a change in a module or part of the application for testing that is the code change will affect rest of the application. Testing some other test cases/functionality also to ensure that the above fix havent introduce any problem to existing code/functionality which was working fine earlier.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Globalization TestingGlobalization Testing the applications for different languages is called as globalization testing. Globalization Testing is validating a specific Application or Product that can support multiple languages or that can be accessed by different Locales around the Globes.

Two major Components Internationalization & Localization. Internationalization (I18N) :Testing the application for multiple languages using property files. This type of testing is done for multiple languages using suffix and prefix. Localization (L10N) Testing the application as per country standard is called localization(L10N) testing e.g.. pin code, std code , currency.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Software Testing Life Cycle (STLC)

Software Development and Software Testing Life cycles go parallel 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Test PlansTest Plan - Derives future activities of Testing process. A Test Plan should be Overall coverage of Test to be conducted useful and Understandable by the people Inside and Outside the Test group.

Test Plan Consists of following attributes.Objective 8.Risk Scope9.Mitigation/ Contingency PlanTest Approach 10.Enviornment(H/W, S/W)Test Methodology11.Automation toolsRoles & Responsibility 12.Effort EstimationSchedule 13.Entry & Exit CriteriaAssumption 14.Test Deliverables 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Test Cases / Use casesTest Case is a Collection of Test steps also call it as a Design Case.

Test Case Template should contains 3 parts : 1. Header 2. Body 3. Footer Use Case can be a basis for deriving the tests for a System.

UML (Unified Modeling Language)is the facilities for drawing the Use case diagrams.

It is used during the Analysis phase of Project, they separate the System into Actors and Use Cases. 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Test Case Template

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Test Case Design TechniquesInvolves designing the Test cases (Inputs/Outputs) used to test the System.

The goal of Test case design is to create a set of tests that are effective in Validation and Defect Testing.

Design Approaches

Error GuessingIn this approach the test engineer keeps on guessing thevalues according to his understanding

Equivalence PartitioningIf input is range of values then derive the test case for one valid and two invalid data.If the input is set of values then derive the test case for one valid and two invalid inputs.

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential# Testing ApproachesWhite-box testingControl-flow-based testingData-flow-based testing

Black-box testingEquivalence partitioning

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#Control-flow-based Testing12345678s:=0;d:=0;while(x 5) bonus := 1; else bonus := 0.7; break; case MANAGER: bonus := 1.5; if (retiring_soon) bonus := 1.2 * bonus break; case .endswitch

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#43Mapping for LoopsWhile (c) {.}

Note: other loops (e.g. FOR,DO-WHILE, ) are mapped similarly

Mini-assignment: figure out how this is done

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#44Statement CoverageGiven the control flow graph, define a coverage target and write test cases to achieve itTraditional target: statement coverageTest cases that cover all nodesCode that has not been executed during testing is more likely to contain errorsOften this is the low-probability code

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#45correct the spellingEXAMPLE Same example as before: two test cases

Path 1-2-exit

Path 1-2-3-4-5-7-8-2-3-4-5-7-8-2-exit

Problem: The false branch of 4 is never taken dont have 100% branch coverage12345678TF 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#46Branch CoverageTarget: write test cases that cover all branches of predicate nodesTrue and false branches of each IFThe two branches corresponding to the condition of a loopAll alternatives in a SWITCHIn modern languages, branch coverage implies statement coverage 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#47Branch CoverageStatement coverage does not imply branch coverageExample: if (c) then s;By executing only with c=true, we will achieve statement coverage, but not branch coverageMotivation: experience shows that many errors occur in decision makingPlus, it subsumes statement coverage 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#48correct the spellingEXAMPLE Same example as before: two test cases

Path 1-2-exit

Path 1-2-3-4-5-7-8-2-3-4-5-7-8-2-exit

Problem: the false branch of 4 is never taken dont have 100% branch coverage12345678TF 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#49Achieving Branch CoverageBranch coverage: a necessary minimumPick a set of start-to-end paths that cover all branches, and write test cases to execute these pathsBasic strategyAdd a new path that covers at least one edge that is not covered by the current pathsSometimes the set of paths chosen with this strategy is called the basis set

2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#50Data-flow-based TestingTest connections between variable definitions (write) and variable uses (read)Variation of the control flow graphA node represents a single statement, not a single-entry-single-exit chain of statementsSet DEF(n) contains variables that are defined at node n (i.e., they are written)Set USE(n): variables that are read 2013 QuEST Global, Inc. Confidential#2013 QuEST Global Services Pte Ltd. Confidential#51EXAMPLEAssume y is already initialized1 s:=02 x:=03 while(x