Software Testing Tutorial - Digital Point

Transcription

Software Testing Tutorial

SOFTWARE TESTING TUTORIALSimply Easy Learning by tutorialspoint.comtutorialspoint.comi

COPYRIGHT & DISCLAIMER NOTICE All the content and graphics on this tutorial are the property of tutorialspoint.com. Any content fromtutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without thewritten permission of tutorialspoint.com. Failure to do so is a violation of copyright laws.This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the accuracy ofthe site or its contents including this tutorial. If you discover that the tutorialspoint.com site or this tutorialcontent contains some errors, please contact us at webmaster@tutorialspoint.comii

Table of ContentsTesting Overview . 1What is testing? . 1Who does testing?. 1Difference between Verification & Validation . 2Difference between Testing, Quality Assurance and Quality Control. 3Difference between Audit and Inspection . 3Difference between Testing and Debugging . 3Testing Myths . 4Testing and ISO Standards . 5Testing Types. 8Manual Testing . 8Automation Testing . 8Testing Methods. 10Black Box Testing. 10White Box Testing . 10Grey Box Testing . 11Levels of Testing . 13Functional Testing . 13Unit Testing . 14Limitations of Unit Testing . 14Integration Testing . 14System Testing . 14Regression Testing . 15Acceptance Testing . 15Non-Functional Testing . 16Performance Testing . 16Usability Testing . 17Security Testing. 17Portability Testing . 18Testing Documentation . 19Test Plan . 19Test Scenario . 20iii

Test Case . 20Traceability Matrix . 21Estimation Techniques . 22iii

1CHAPTERTesting OverviewThis chapter describes the basic definition and concepts of Testing from Software pointof view.What is testing?Testing is the process of evaluating asystem or its component(s) with the intentto find that whether it satisfies the specifiedrequirements or not. This activity results inthe actual, expected and difference betweentheir results. In simple words testing isexecuting a system in order to identify anygaps, errors or missing requirements grationSystemAccording to ANSI/IEEE 1059 standard, Testing can be defined as “A process of analyzinga software item to detect the differences between existing and required conditions (thatis defects/errors/bugs) and to evaluate the features of the software item”.Who does testing?It depends on the process and the associated stakeholders of the project(s). In the ITindustry, large companies have a team with responsibilities to evaluate the developedsoftware in the context of the given requirements. Moreover, developers also conducttesting which is called Unit Testing. In most cases, following professionals are involved intesting of a system within their respective capacities: Software TesterSoftware DeveloperProject Lead/ManagerEnd UserTUTORIALS POINTSimply Easy LearningPage 1

Different companies have difference designations for people who test the software on thebasis of their experience and knowledge such as Software Tester, Software QualityAssurance Engineer, and QA Analyst etc.It is not possible to test the software at any time during its cycle. The next two sectionsstate when testing should be started and when to end it during the SDLC.i.When to Start TestingAn early start to testing reduces the cost, time to rework and error free software that isdelivered to the client. However in Software Development Life Cycle (SDLC) testing canbe started from the Requirements Gathering phase and lasts till the deployment of thesoftware. However it also depends on the development model that is being used. Forexample in Water fall model formal testing is conducted in the Testing phase, but inincremental model, testing is performed at the end of every increment/iteration and atthe end the whole application is tested.Testing is done in different forms at every phase of SDLC like during Requirementgathering phase, the analysis and verifications of requirements are also consideredtesting. Reviewing the design in the design phase with intent to improve the design isalso considered as testing. Testing performed by a developer on completion of the code isalso categorized as Unit type of testing.ii.When to Stop TestingUnlike when to start testing it is difficult to determine when to stop testing, as testing is anever ending process and no one can say that any software is 100% tested. Followingare the aspects which should be considered to stop the testing: Testing Deadlines. Completion of test case execution. Completion of Functional and code coverage to a certain point. Bug rate falls below a certain level and no high priority bugs are identified. Management decision.Difference between Verification & ValidationThese two terms are very confusing for people, who use them interchangeably. Let’sdiscuss about them briefly.VerificationAre you building it right?Ensure that the software system meets allthe functionality.Verification takes place first and includesthe checking for documentation, code etc.Done by developers.Have static activities as it includes thereviews, walkthroughs, and inspections toverify that software is correct or not.It is an objective process and no subjectivedecision should be needed to verify theSoftware.TUTORIALS POINTSimply Easy LearningValidationAre you building the right thing?Ensure that functionalities meet theintended behavior.Validation occurs after verification andmainly involves the checking of the overallproduct.Done by Testers.Have dynamic activities as it includesexecuting the software against therequirements.It is a subjective process and involvessubjective decisions on how well theSoftware works.Page 2

Difference between Testing, Quality Assuranceand Quality ControlMost people are confused with the concepts and difference between Quality Assurance,Quality Control and Testing. Although they are interrelated and at some level they can beconsidered as the same activities, but there is indeed a difference between them.Mentioned below are the definitions and differences between them:Quality AssuranceActivities which ensure theimplementationofprocesses, procedures andstandards in context toverification of developedsoftwareandintendedrequirements.Focuses on processes andproceduresratherthenconducting actual testingon the system.Process oriented activities.Preventive activitiesIt is a subset of SoftwareTest Life Cycle (STLC)Quality ControlActivities which ensure theverification of developedsoftware with respect todocumented (or not insome cases) requirements.TestingActivities which ensure theidentificationofbugs/error/defects in theSoftware.Focuses on actual testingby executing Software nofprocedures and process.Product oriented activities.It is a corrective process.QC can be considered asthesubsetofQualityAssurance.Focuses on actual testing.Product oriented activities.It is a preventive processTesting is the subset ofQuality Control.Difference between Audit and InspectionAudit: A systematic process to determine how the actual testing process is conductedwithin an organization or a team. Generally, it is an independent examination ofprocesses which are involved during the testing of software. As per IEEE, it is a review ofdocumented processes whether organizations implements and follows the processes ornot. Types of Audit include the Legal Compliance Audit, Internal Audit, and System Audit.Inspection: A formal technique which involves the formal or informal technical reviewsof any artifact by identifying any error or gap. Inspection includes the formal as well asinformal technical reviews. As per IEEE94, Inspection is a formal evaluation technique inwhich software requirements, design, or code are examined in detail by a person orgroup other than the author to detect faults, violations of development standards, andother problems.Formal Inspection meetings may have following process: Planning, Overview Preparation,Inspection Meeting, Rework, and Follow-up.Difference between Testing and DebuggingTesting: It involves the identification of bug/error/defect in the software withoutcorrecting it. Normally professionals with a Quality Assurance background are involved inthe identification of bugs. Testing is performed in the testing phase.TUTORIALS POINTSimply Easy LearningPage 3

Debugging: It involves identifying, isolating and fixing the problems/bug. Developerswho code the software conduct debugging upon encountering an error in the code.Debugging is the part of White box or Unit Testing. Debugging can be performed in thedevelopment phase while conducting Unit Testing or in phases while fixing the reportedbugs.Testing MythsGiven below are some of the more popular and common myths about Software testing.Myth: Testing is too expensive.Reality: There is a saying, pay less for testing during software development or pay morefor maintenance or correction later. Early testing saves both time and cost in manyaspects however, reducing the cost without testing may result in the improper design ofa software application rendering the product useless.Myth: Testing is time consuming.Reality: During the SDLC phases testing is never a time consuming process. Howeverdiagnosing and fixing the error which is identified during proper testing is a timeconsuming but productive activity.Myth: Testing cannot be started if the product is not fully developed.Reality: No doubt, testing depends on the source code but reviewing requirements anddeveloping test cases is independent from the developed code. However iterative orincremental approach as a development life cycle model may reduce the dependency oftesting on the fully developed software.Myth: Complete Testing is Possible.Reality: It becomes an issue when a client or tester thinks that complete testing ispossible. It is possible that all paths have been tested by the team but occurrence ofcomplete testing is never possible. There might be some scenarios that are neverexecuted by the test team or the client during the software development life cycle andmay be executed once the project has been deployed.Myth: If the software is tested then it must be bug free.Reality: This is a very common myth which clients, Project Managers and themanagement team believe in. No one can say with absolute certainty that a softwareapplication is 100% bug free even if a tester with superb testing skills has tested theapplication.Myth: Missed defects are due to Testers.Reality: It is not a correct approach to blame testers for bugs that remain in theapplication even after testing has been performed. This myth relates to Time, Cost, andRequirements changing Constraints. However the test strategy may also result in bugsbeing missed by the testing team.Myth: Testers should be responsible for the quality of a product.Reality: It is a very common misinterpretation that only testers or the testing teamshould be responsible for product quality. Tester’s responsibilities include theidentification of bugs to the stakeholders and then it is their decision whether they will fixTUTORIALS POINTSimply Easy LearningPage 4

the bug or release the software. Releasing the software at the time puts more pressureon the testers as they will be blamed for any error.Myth: Test Automation should be used wherever it is possible to use it and to reducetime.Reality: Yes it is true that Test Automation reduces the testing time but it is not possibleto start Test Automation at any time during Software development. Test Automatonshould be started when the software has been manually tested and is stable to someextent. Moreover, Test Automation can never be used if requirements keep changing.Myth: Any one can test a Software application.Reality: People outside the IT industry think and even believe that any one can test thesoftware and testing is not a creative job. However testers know very well that this ismyth. Thinking alternatives scenarios, try to crash the Software with the intent to explorepotential bugs is not possible for the person who developed it.Myth: A tester’s task is only to find bugs.Reality: Finding bugs in the Software is the task of testers but at the same time they aredomain experts of the particular software. Developers are only responsible for thespecific component or area that is assigned to them but testers understand the overallworkings of the software, what the dependencies are and what the impacts of onemodule on another module are.Testing and ISO StandardsMany organizations around the globe are developing and implementing differentStandards to improve the quality needs of their Software. The next section brieflydescribes some of the widely used standards related to Quality Assurance and Testing.Here is a definition of some of them:ISO/IEC 9126: This standarddeals with the following aspects todetermine the quality of a softwareapplication: Quality model External metrics Internal metrics Quality in use metrics.This standard presents some set ofquality attributes for any Softwaresuch as: Functionality Reliability Usability Efficiency Maintainability PortabilityThe above mentioned quality attributes are further divided into sub-factors. These subcharacteristics can be measured by internal or external metrics as shown in the graphicaldepiction of ISO-9126 model.TUTORIALS POINTSimply Easy LearningPage 5

ISO/IEC 9241-11: Part 11 of thisstandard deals with the extent towhich a product can be used byspecified users to achieve specifiedgoals with Effectiveness, Efficiencyand Satisfaction in a specified contextof use.This standard proposed a frameworkwhichdescribestheusabilitycomponents and relationship betweenthem. In this standard the usability n.According to ISO 9241-11 usabilitydepends on context of use and the level of usability will change as the context changes.ISO/IEC 25000: ISO/IEC 25000:2005 is commonly known as the standard which givesthe guidelines for Software product Quality Requirements and Evaluation (SQuaRE). Thisstandard helps in organizing and enhancing the process related to Software qualityrequirements and their evaluations. In reality, ISO-25000 replaces the two old ISOstandards i.e. ISO-9126 and ISO-14598.SQuaRE is divided into sub parts such as: ISO 2500n - Quality Management Division. ISO 2501n - Quality Model Division. ISO 2502n - Quality Measurement Division. ISO 2503n - Quality Requirements Division. ISO 2504n - Quality Evaluation Division.The main contents of SQuaRE are: Terms and definitions. Reference Models. General guide. Individual division guides. Standard related to Requirement Engineering (i.e. specification, planning,measurement and evaluation processISO/IEC 12119: This standard deals with Software packages delivered to the client. Itdoes not focus or deal with the client’s (the person/organization whom Software isdelivered) production process. The main contents are related to the following items: Set of Requirements for Software packages.Instructions for testing the delivered Software package against the requirements.Some of the other standards related to QA and Testing processes are:IEEE 829: A standard for the format of documents used in different stages of softwaretesting.IEEE 1061: A methodology for establishing quality requirements, identifying,implementing, analyzing, and validating the process and product of software qualitymetrics is defined.IEEE 1059: Guide for Software Verification and Validation Plans.IEEE 1008: A standard for unit testing.IEEE 1012: A standard for Software Verification and Validation.IEEE 1028: A standard for software inspections.IEEE 1044: A standard for the classification of software anomalies.IEEE 1044-1: A guide to the classification of software anomalies.IEEE 830: A guide for developing system requirements specifications.TUTORIALS POINTSimply Easy LearningPage 6

IEEE 730: A standard for software quality assurance plans.IEEE 1061: A standard for software quality metrics and methodology.IEEE 12207: A standard for software life cycle processes and life cycle data.BS 7925-1: A vocabulary of terms used in software testing.BS 7925-2: A standard for software component testing.TUTORIALS POINTSimply Easy LearningPage 7

2CHAPTERTesting TypesThis section describes the different types of testing which may be used to test a Softwareduring SDLC.Manual TestingThis type includes the testing of the Software manually i.e. without using anyautomated tool or any script. In this type the tester takes over the role of an end userand test the Software to identify any un-expected behavior or bug. There are differentstages for manual testing like unit testing, Integration testing, System testing and UserAcceptance testing.Testers use test plan, test cases or test scenarios to test the Software to ensure thecompleteness of testing. Manual testing also includes exploratory testing as testersexplore the software to identify errors in it.Automation tion testing which is also known as “Test Automation”, is when the tester writesscripts and uses another software to test the software. This process involves automationTUTORIALS POINTSimply Easy LearningPage 8

of a manual process. Automation Testing is used to re-run the test scenarios that wereperformed manually, quickly and repeatedly.Apart from regression testing, Automation testing is also used to test the applicationfrom load, performance and stress point of view. It increases the test coverage; improveaccuracy, saves time and money in comparison to manual testing.What to automate: It is not possible to automate everything in the Software; howeverthe areas at which user can make transactions such as login form or registration formsetc, any area where large amount of users’ can access the Software simultaneouslyshould be automated.Furthermore all GUI items, connections with databases, field validations etc. can beefficiently tested by automating the manual process.When to Automate: Test Automation should be uses by considering the following forthe Software: Large and critical projects. Projects that require testing the same areas frequently. Requirements not changing frequently. Accessing the application for load and performance with many virtual users. Stable Software with respect to manual testing. Availability of time.How to Automate: Automation is done by using a supportive computer language like VBscripting and an automated software application. There are a lot of tools available whichcan be used to write automation scripts. Before mentioning the tools lets identify theprocess which can be used to automate the testing: Identifying areas within a software for automation.Selection of appropriate tool for Test automation.Writing Test scripts.Development of Test suits.Execution of scriptsCreate result reports.Identify any potential bug or performance issue.Following are the tools which can be used for Automation testing: HP Quick Test ProfessionalSeleniumIBM Rational Functional TesterSilkTestTestCompleteTesting AnywhereWinRunnerLaodRunnerVisual Studio Test ProfessionalWATIRTUTORIALS POINTSimply Easy LearningPage 9

3CHAPTERTesting MethodsThere are different methods which can be used for Software testing. This chapter brieflydescribes those methods.Black Box TestingThe technique of testing without having any knowledge of the interior workings ofthe application is Black Box testing. The tester is oblivious to the system architecture anddoes not have access to the source code. Typically, when performing a black box test, atester will interact with the system’s user interface by providing inputs and examiningoutputs without knowing how and where the inputs are worked upon.Advantages: Well suited and efficient for large code segments.Code Access not required.Clearly separates user’s perspective from the developer’s perspective throughvisibly defined roles.Large numbers of moderately skilled testers can test the application with noknowledge of implementation, programming language or operating systems.Disadvantages: Limited Coverage since only a selected number of test scenarios are actuallyperformed.Inefficient testing, due to the fact that the tester only has limited knowledgeabout an application.Blind Coverage, since the tester cannot target specific code segments or errorprone areas.The test cases are difficult to design.White Box TestingWhite box testing is the detailed investigation of internal logic and structure of the code.White box testing is also called glass testing or open box testing. In order to performTUTORIALS POINTSimply Easy LearningPage 10

white box testing on an application, the tester needs to possess knowledge of the internalworking of the code. The tester needs to have a look inside the source code and find outwhich unit/chunk of the code is behaving inappropriately.Advantages:As the tester has knowledge of the source code, it becomes very easy to find out whichtype of data can help in testing the application effectively. It helps in optimizing the code.Extra lines of code can be removed which can bring in hidden defects.Due to the tester's knowledge about the code, maximum coverage is attainedduring test scenario writing.Disadvantages: Due to the fact that a skilled tester is needed to perform white box testing, thecosts are increased.Sometimes it is impossible to look into every nook and corner to find out hiddenerrors that may create problems as many paths will go untested.It is difficult to maintain white box testing as the use of specialized tools likecode analyzers and debugging tools are required.Grey Box TestingGrey Box testing is a technique to test the application with limited knowledge of theinternal workings of an application. In software testing, the term “the more you know thebetter” carries a lot of weight when testing an application.Mastering the domain of a system always gives the tester an edge over someone withlimited domain knowledge. Unlike black box testing, where the tester only tests theapplication’s user interface, in grey box testing, the tester has access to designdocuments and the database. Having this knowledge, the tester is able to better preparetest data and test scenarios when making the test plan.Advantages: Offers combined benefits of black box and white box testing wherever possible.Grey box testers don’t rely on the source code; instead they rely on interfacedefinition and functional specifications.Based on the limited information available, a grey box tester can designexcellent test scenarios especially around communication protocols and data typehandling.The test is done from the point of view of the user and not the designer.Disadvantages: Since the access to source code is not available, the ability to go over the codeand test coverage is limited.The tests can be redundant if the software designer has already run a test case.Testing every possible input stream is unrealistic because it would take anunreasonable amount of time; therefore, many program paths will go untested.Visual Difference between the Three Testing MethodsTUTORIALS POINTSimply Easy LearningPage 11

ullyKnownComparison between the Three Testing TypesBlack Box TestingThe Internal Workings ofan application are notrequired to be knownGrey Box TestingSomewhat knowledge ofthe internal workings areknown2.Also known as closed boxtesting, data driventesting and functionaltesting3.Performed by end usersand also by testers anddevelopers-Testing is based onexternal expectations-Internal behavior of theapplication is unknownThis is the least timeconsuming andexhaustiveNot suited to algorithmtestingThis can only be done bytrial and error methodAnother term for grey boxtesting is translucenttesting as the tester haslimited knowledge of theinsides of the applicationPerformed by end usersand also by testers anddevelopersTesting is done on thebasis of high leveldatabase diagrams anddata flow diagramsPartly time consumingand exhaustive1.4.5.6.7.TUTORIALS POINTSimply Easy LearningNot suited to algorithmtestingData domains andInternal boundaries canbe tested, if knownWhite Box TestingTester has fullknowledge of theInternal workings ofthe applicationAlso known as clearbox testing, structuraltesting or code basedtestingNormally done bytesters and developersInternal workings arefully known and thetester can design testdata accordinglyThe most exhaustiveand time consumingtype of testingSuited for algorithmtestingData domains andInternal boundariescan be better testedPage 12

4CHAPTERLevels of TestingThere are different levels during the process of Testing. In this chapter a briefdescription is provided about these levels.Levels of testing include the different methodologies that can be used whileconducting Software Testing. Following are the main levels of Software Testing: Functional Testing.Non- functional Testing.Functional TestingThis is a type of black box testing that is based on the specifications of the software thatis to be tested. The application is tested by providing input and then the results areexamined that need to conform to the functionality it was intended for. FunctionalTesting of the software is conducted on a complete, integrated system to evaluate thesystem's compliance with its specified requirements. There are five steps that areinvolved when testing an application for functionality. Step I - The determination of the functionality that the intended application ismeant to perform.Step II - The creation of test data based on the specifications of the application.Step III - The output based on the test data and the specifications of theapplication.Step IV - The writing of Test Scenarios and the execution of test cases.Steps V - The comparison of actual and expected results based on the executedtest cases.An effective testing practice will see the above steps applied to the testing policies ofevery organization and hence it will make sure that the organization maintains thestrictest of standards when it comes to software quality.TUTORIALS POINTSimply Easy LearningPage 13

Unit TestingThis type of testing is performed by the developers before the setup is handed over tothe testing team to formally execute the test cases. Unit testing is performed by therespective developers on the individual units of source code assigned areas. Thedevelopers use test data that is separate from the test data of the quality assuranceteam.The goal of unit testing is to isolate each part of the program and show that individualparts are correct in terms of requirements and functionality.Limitations of Unit TestingTesting cannot catch each and every bug in an application. It is impossible to evaluateevery execution path in every software application. The same is the case with unittesting. There is a limit to the number of scenarios and test data that the developer canuse to verify the source code. So after he has exhausted all options there is no choice butto stop unit testing and merge the code segment with other un

Myth: If the software is tested then it must be bug free. Reality: This is a very common myth which clients, Project Managers and the management team believe in. No one can say with absolute certainty that a software application is 100% bug free even if a tester