Slide 1Slide 2OverviewThe requirements pyramidTraceability requirements pyramid Role of TraceabilitySlide 7Slide 8Use Case DiagramSlide 10Basic flow of the use case place an orderSlide 12ConversationSlide 14All ScenariosSlide 16Finding scenarios in a use caseInfinite loopsStatsSlide 20Slide 21Generating test casesStep 1: Identify variables for each use case stepSlide 24Options that were identified for variables in the basic flowStep 3: Combine options to be tested into test casesSlide 27Combine options to create test casesSlide 29Test PathsStep 4: Assign values to variables(Test Case 1 for test path 1)Traceability activities mapped to RUP phases ConclusionsTraceability from Use Cases to Test CasesGannon University Dr. Frank Xu01/14/20191 CIS310 Software Design & TestingPeter Zielczynski!([email protected]), Director of Technology Solutions, The A Consulting Team, Inc.http://www.ibm.com/developerworks/rational/library/04/r-3217/01/14/20192 CIS310 Software Design & TestingOverviewThe article illustrates a formal method of deriving functional test cases from use cases,including how to create a use case, derive all scenarios, and create reasonable test cases, as well as use IBM® Rational® RequisitePro for traceability from use cases to scenarios and test cases.01/14/20193 CIS310 Software Design & TestingThe requirements pyramid01/14/20194 CIS310 Software Design & TestingTraceability requirements pyramid01/14/20195 CIS310 Software Design & TestingRole of TraceabilityCoverage AnalysisVerify that an implementation fulfills all requirementsEverything that the customer requested was implementedVerify that the application does only what was requestedDon't implement something that the customer never asked forHelp with change management: When some requirements change, we want to know which test cases should be redone to test this change01/14/20196 CIS310 Software Design & Testing01/14/20197 CIS310 Software Design & Testing01/14/20198 CIS310 Software Design & TestingUse Case DiagramThe general format of a use case is:Brief descriptionFlow of eventsBasic flowAlternative flow 1Alternative flow 2Special requirementsPreconditionsPost-conditionsExtension pointsContext diagramActivity diagram01/14/20199 CIS310 Software Design & TestingThe basic flow contains the most popular sequence of actions, the steps that happen when everything goes correctly. Alternative flows represent variations of the flow, including less usual cases and error conditions. A context diagram is a part of a use case diagram showing the relationships of this particular use case to actors and other use cases. An activity diagram is a flow chart that explains the use case. The context diagram and the activity diagram are not necessary, but help you visualize the use case and its position in the project.01/14/201910 CIS310 Software Design & TestingBasic flow of the use case place an orderB1 User enters web site address in the browser.System displays login page.B2 User enters an email address and a password.System confirms correct login, presents main page, and prompts for a search string.B3 User enters search string – partial name of a book.System returns all books matching search criteria.B4 User selects a book. System presents detailed information about a book.B5 User adds the book to a shopping cart.Shopping cart contents is presented to the user.B6 User selects "proceed to checkout" option.System asks for confirmation of a shipping address.B7 User confirms shipping address.System presents shipping options.B8 User selects shipping option.Systems asks which credit card will be used.B9 User confirms credit card that is stored in the system.System asks for final confirmation to place an order.B10 User places the order.System returns a confirmation number.01/14/201911 CIS310 Software Design & TestingAlternative flows that were included in the use case "place an order"Table 1: Alternative flowsA1 Unregistered userA2 Invalid passwordA3 No books matching search criteria were foundA4 Decline a bookA5 Continue shopping after storing a book in the shopping cartA6 Enter a new addressA7 Enter a new credit cardA8 Cancel order01/14/201912 CIS310 Software Design & TestingConversationThe following convention is used for naming the flows:Basic flow: BAlternative flows: A1, A2, A3, ...Steps in a basic flow: B1, B2, B3, ...Steps in alternative flow 1: A1.1, A1.2, A1.3, ...Steps in alternative flow 2: A2.1, A2.2, A2.3, ...01/14/201913 CIS310 Software Design & Testing01/14/201914 CIS310 Software Design & TestingAll Scenarios01/14/201915 CIS310 Software Design & Testing01/14/201916 CIS310 Software Design & TestingFinding scenarios in a use case a hypothetical graph representing a use case with a basic flow B and alternative flows A1, A2, A3, and A4. To find all scenarios, we need to draw all possible lines through this graph.01/14/201917 CIS310 Software Design & TestingInfinite loopsThe reasonable approach is to do the basic flow once, do a loop once, and then do a loop a second time.01/14/201918 CIS310 Software Design & TestingStatsThe book ordering example has a basic flow and eight alternative flows. Four of them are going backwards, and the other four are going forward. If you want to describe all possible use case combinations, you will have over four thousand scenarios there are eight alternative flows, four of which we may want to do twice because they are loops going backwards, so together it is 2 to the power of (8+4), which is equal to 4096. Obviously we don't need to do all of them!01/14/201919 CIS310 Software Design & TestingChoose which ones represent a reasonable subset of these four thousand scenarios. Usually it is wise to select a basic flow, one scenario covering each alternative flow, and some reasonable combinations of alternative flows. Using the examples in Table 1, it probably won't make sense to do a scenario that contains both flows A1 and A7, because they are so far apart on the diagram that they don't have any influence on each other. But it makes sense to do A1 and A2, since they are immediately after each other and may be correlated.01/14/201920 CIS310 Software Design & TestingTable 2: Capturing selected scenariosScenario 1 Basic Flow Scenario 9 A8 Scenario 2 A1 Scenario 10 A1, A2 Scenario 3 A2
View Full Document