uml test case

Upload: hiteshi-verma

Post on 08-Apr-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 UML Test Case

    1/47

  • 8/6/2019 UML Test Case

    2/47

    What is UML?What is UML?y Unified Modelling Language

    A language for specifying, visualising & constructing thedescriptive diagrams and documentation of softwaresystems

    Industry standard for object-oriented modellingHelps in designing and describing software systemWere aiming for a well-designed, robust &maintainable object-oriented system which meets theusers requirementsx What does the user require?x Which classes should there be?x What responsibilities should each class have?x How should objects interact?

  • 8/6/2019 UML Test Case

    3/47

  • 8/6/2019 UML Test Case

    4/47

  • 8/6/2019 UML Test Case

    5/47

    Where did UML come from?Where did UML come from?y T

    he 1980sC++ was bornObject-oriented programming language emerged SmalltalkOO graphical modelling languages appeared in 1988

    y T he 1990s A number of key books and leading figures between 1988& 1992Unified Method version 0.8 by Booch & Rumbaugh, 1995

    UML 1.0 by Booch, Rumbaugh & Jacobson (a.k.a. 3amigos), 1997

    An open standard controlled by the Object ManagementGroup, a consortium of companies www.omg.org

    UML 2.0, a major revision adopted by OMG in 2005

  • 8/6/2019 UML Test Case

    6/47

    T here are 9 types of diagrams inT here are 9 types of diagrams in UMLUML

    SequenceDiagrams

    CollaborationDiagrams

    Activity

    Diagrams

    StatechartDiagrams

    Class

    Diagrams

    ObjectDiagrams

    ComponentDiagrams

    DeploymentDiagrams

    Use CaseDiagrams

    Model

  • 8/6/2019 UML Test Case

    7/47

    Su mmary of diagram kinds in UML (nineSu mmary of diagram kinds in UML (nineconcrete kinds)concrete kinds)

    y Structural diagramsStatic structural diagramsx Class diagramsx Object diagrams

    Implementation diagramsx Component diagramsx Deployment diagrams

    y Behavior diagramsU se case diagramsInteraction diagramsx S equence diagramsx Collaboration diagramsS tate chart diagramsActivity diagrams

  • 8/6/2019 UML Test Case

    8/47

    Requirements of the system

    Ex ample: Library Management SystemEx ample: Library Management System

    y R eq.1 : Register a new member (id, name, phone no.,address)done by librarian.

    y Req. 2: Update/Delete a student record.

    The student will beselected by librarian using the unique student id. Name,

    address, phone number of a student can be updated. Astudent record can be deleted, if no books are issued to hisid.

    y R eq. 3: Add a book. (Accession no. ,title, author, publication)

    y R eq. 4: Delete/Update a book. A book can be deleted bylibrarian if its not issued to any member. A book can beupdated by its unique accession number. T itle, author andpublication can be updated.

  • 8/6/2019 UML Test Case

    9/47

    Requirements of the system

    y R eq.5 : Search Book. Books can be searched usingaccession no., title, author or publication.

    y R eq. 6: V iew a book detail. By using the title a books detail(including no. of copies) can be viewed by the member or librarian.

    y R eq. 7: V iew student detail. Librarian can view member name, id, phone, addr., books issued to user(title, accession

    no., due date), fine details.

    y R eq. 8: V iew members status: After login a member canview books (details) issued to him, due fine to be paid.

  • 8/6/2019 UML Test Case

    10/47

    Use case diagramsUse case diagramsy Use cases

    are a technique for capturing the functionalrequirements of a system

    describe the interactions between the users of asystem & the system itself

    y A narrative of how a system is used

    Textual (always) & di agram (when useful)descriptionsK eep high-level, dont divide into lots of sub usecases

    Collectively describe all possible interactions with thesystem

    y F or example:

    Library use case: B orrow B ook

  • 8/6/2019 UML Test Case

    11/47

    Use Case Modeling: Core E lementsUse Case Modeling: Core E lements

  • 8/6/2019 UML Test Case

    12/47

    Use Case Modeling: Core E lementsUse Case Modeling: Core E lements

  • 8/6/2019 UML Test Case

    13/47

    Use Case DiagramUse Case Diagram - - LMSLMS

    Member F aculty

    Student Librarian

    Add newstudent

    V iew Student

    detail

    Add book

    V iew Bookdetail

    Update/Deletestudent

    V iewmembers

    status

    Login

    Search book

    Update/Deletebook

    Use forgetpassword

    option

  • 8/6/2019 UML Test Case

    14/47

    Use Case Model: Use Case DiagramsUse Case Model: Use Case Diagramsand Descriptionsand Descriptions

    y Use Case T itley Use Case Idy Actorsy Descriptiony Pre conditionsy Task Sequencey Post conditionsy Modification Historyy Author

  • 8/6/2019 UML Test Case

    15/47

    Use Case DescriptionUse Case Description - - LMSLMS

    1. Use Case T itle Search Book

    2. Abbreviated T itle Search Book

    3. Use Case Id 5

    4. Actors Member

    5. Description

    With this search facility, user can specify any of search criteria. F or example, title,author, publication, accession no. etc., and search the desired book.

    5.1. Pre Conditions: User must be logged in(session)

    5.2. Task Sequence1. Search screen will be shown by the system2. Select search criteria and enter the required information.

    3. On clicking the search button, system will show search results.

    5.3. Post Conditions:1. User can view his desired results.2. User can go for another search.

    6. Modification History: Date 21-apr-2010

    7. Author: Harkiran K aur Project Id LMS

  • 8/6/2019 UML Test Case

    16/47

    A ctivity diagramsA ctivity diagramsy

    Activity diagrams area technique to describe procedural logic, businessprocess & work flowsimilar to flowcharts, but the latter does not supportparallel behaviour used to model a specific use case at a more detailed level

    y Stateshave transitions to other statesmay be either x action states: atomic actionx activity states: actions that can be broken downmay have decisions , explained by conditions & mergesmay have f orks & joins for modelling simultaneous

    activities

  • 8/6/2019 UML Test Case

    17/47

    A ctivity diagram notationA ctivity diagram notationy Action/Activity

    Long rounded rectangle

    y S tart/Initial S tate

    unique with only one transition line

    y E nd S tatenot necessarily unique

    y TransitionLines indicate sequential flow of actions.Must be labeled after a decision.

    Arrows indicate direction of next action

    User Information

  • 8/6/2019 UML Test Case

    18/47

    Sw imlanes / partitionsSw imlanes / partitions - - LMSLMS

    M ember DatabaseLMS

    [valid user]

    [invaliduser]

    [valid/invalid user]

    [available/not found]

    [available]

    [notfound]

    User Information

    Login Authentication

    Search Book

    Logout

    Book details

    BookInformation

  • 8/6/2019 UML Test Case

    19/47

    State chart DiagramsState chart Diagramsy

    A State chart diagram shows the lifecycle of an object A state is a condition of an object for a particular time An event causes a transition from one state to another stateHere is a State chart for a Phone Line object:

    initial Statestate

    transition

    event

  • 8/6/2019 UML Test Case

    20/47

    State charts NotationsState charts Notations

    NewState

    E ve n t/ Gu a rdcondi tion

    Initia l State

    State

    T r a nsi tion

    [inva lid us e r]

    E nd State

  • 8/6/2019 UML Test Case

    21/47

    State chart DiagramState chart Diagram - - LMSLMS

    LoginA u thentication

    [valid user]

    [invaliduser]

    Search book

    Book Information

    [available]

    [notfound]

    Logou t

    id, password

    Chosenlogoutoption

    Message Display

    Chosenlogoutoption

  • 8/6/2019 UML Test Case

    22/47

    Interaction diagram to u rInteraction diagram to u ry Interaction:describes a collection of communications

    between instances, including all ways to affect instances,like operation invocation, as well as creation and destructionof instances

    y T he communications are partially ordered (in time)y Show interactions between instances in the model

    graph of instances (possibly including links) and stimuliexisting instancescreation and deletion of instances

    y K indssequence diagram (temporal focus)collaboration diagram (structural focus)

  • 8/6/2019 UML Test Case

    23/47

    y A sequence diagram is an interaction diagram thatemphasizes the time ordering of messages.

    y A sequence diagram shows a set of objects and themessages sent and received by those objects.

    y T he objects are typically named or anonymousinstances of classes, but may also represent instancesof other things, such as collaborations, components,and nodes.

    y You use sequence diagrams to illustrate the dynamicview of a system.

    Seq u ence diagramSeq u ence diagram

  • 8/6/2019 UML Test Case

    24/47

    y A collaboration diagram is an interaction diagram thatemphasizes the structural organization of the objectsthat send and receive messages.

    y A collaboration diagram shows a set of objects,links

    among those objects, and messages sent and receivedby those objects.

    y T he objects are typically named or anonymousinstances of classes, but may also represent instancesof other things, such as collaborations, components,and nodes.

    y You use collaboration diagrams toillustrate the dynamicview of a system

    Collaboration diagramCollaboration diagram

  • 8/6/2019 UML Test Case

    25/47

    Interaction diagramsInteraction diagrams

    x y z

    Sequence Diagram

    a

    b

    c

    Collaboration Diagram

    x y

    z

    1.1: a1.2: c

    1.1.1: bdelete

    lifeline

    activation

    object symbol

    stimulus

  • 8/6/2019 UML Test Case

    26/47

    Seq u ence DiagramSeq u ence Diagram - - LMSLMS:LMSUser

    1: login

    2: authenticate user

    Database

    3: success f ul authentication4: session created

    5: search book6: query database

    7: available book8: book in f ormation

    9: logout

    10: session clear

    object symbol

    lifeline

    activation

    return

    stimulus

  • 8/6/2019 UML Test Case

    27/47

    Collaboration DiagramCollaboration Diagram - - LMSLMS

    DatabaseUser : LMS

    9: logout

    2: authenticate user 6: quer y database

    4: session created

    1: login5: search book

    8: book information10: session clear

    3: successful authentication7: available book

    s t i mulu s

    obj ect sy m bo l l ink sy m bo l

  • 8/6/2019 UML Test Case

    28/47

    What is Class diagram?What is Class diagram?y A class diagram shows the existence of classes and

    their relationships in the logical view of a systemy UML modeling elements in class diagrams are:

    Classes, their structure and behavior.relationships components among the classes likeassociation, aggregation, composition, dependencyand inheritanceMultiplicity and navigation indicatorsRole names or labels.

    y Associationy Aggregationy Compositiony Dependency

  • 8/6/2019 UML Test Case

    29/47

    Association Association

    T hese are the most general type of relationship:

    y It denotes a semantic connection between two classes.

    y It is a weak coupling as associated classes remain

    somewhat independent of each other.y E xample:

    Customer AT

    M system

  • 8/6/2019 UML Test Case

    30/47

    Aggregation AggregationT his is a special type of association.

    y T he association with label contains or is part of is anaggregation.

    y It represents has a relationship.

    y It is used when one object logically or physicallycontains other.

    y T he container is called as aggregate.

    y It has a diamond at its end .y It expresses a whole - part relationships.

    Customer AT M card

  • 8/6/2019 UML Test Case

    31/47

    CompositionComposition

    T his is a strong form of aggregation.y It expresses the stronger coupling between the classes.y T he owner is explicitly responsible for creation and

    deletion of the part.y Any deletion of whole is considered to cascade its part.y T he aggregate has a filled diamond at its end.

    Company Department

  • 8/6/2019 UML Test Case

    32/47

    DependencyDependency

    y Dependency is a semantic relationship between twothings in which a change to one thing (the independentthing) may affect the semantics of the other thing (thedependent thing).

    y Graphically, a dependency is represented as a dashedline, possibly directed, as in F igure

  • 8/6/2019 UML Test Case

    33/47

    Class Diagram...Class Diagram...

  • 8/6/2019 UML Test Case

    34/47

    Class DiagramClass Diagram-- LMSLMS

  • 8/6/2019 UML Test Case

    35/47

    O bject DiagramO bject Diagram Instances and LinksInstances and Links

    Class Object

    Possible object

    name

    Company

    noOf E mploees :int

    HiA: Company

    noOf E mploees=600

    object classattributewith value

  • 8/6/2019 UML Test Case

    36/47

    O bject Diagram w ith LinksO bject Diagram w ith Links

    HiA: Company

    E ngineering :Department

    Grooseveien:Office

    :LocatedAt

    Language:Department

    Gimlemoen:Office

    :LocatedAtCompany

    Department OfficeLocatedAt

    1

    1..*

    1..**

    Class Diagram Object Diagram

    Possibleobject diagram

    Link - A link is an instance of an association,analogous to an object being an instance of aclass.

  • 8/6/2019 UML Test Case

    37/47

    Possible O bject DiagramPossible O bject Diagram - - LMSLMS

    A nju: Librarian

    S imar: M ember Engineering: Book

    Cat1: Catalogue: Updated by

    : Info stored in: Updates info of

    : Searches

  • 8/6/2019 UML Test Case

    38/47

    What is a Component Diagram?What is a Component Diagram?

    y T he component diagram's main purpose is to show thestructural relationships between the components of asystem. [IBM Rational Libraries]

    y UML component diagrams are great for identifying thearchitectural landscape for your system as they enableyou to model the high-level software components, andmore importantly the interfaces to those components.

  • 8/6/2019 UML Test Case

    39/47

    Basic notations of Component DiagramBasic notations of Component Diagram

    y In UML 2 specification , inter f ace symbols" connected to theoutside of the rectangle.

    y In this second approach the interface symbols with a complete

    circle at their end represent an interface that the componentprovides -- this lollipop" symbol is shorthand for a realizationrelationship. Interface symbols with only a hal f circle at their endrepresent an inter f ace that the component requires . F or example, the Order component p rovides two interfaces: Order E ntryand AccountPayable, and the Order component requires thePerson interface.

  • 8/6/2019 UML Test Case

    40/47

    Data access

    Student

    Data access

    Librarian

    Data access

    F acilities

    E ncryption

    Access control

    Persistence

    JDBC

    Component diagramComponent diagram LM SLMS

  • 8/6/2019 UML Test Case

    41/47

  • 8/6/2019 UML Test Case

    42/47

    Deployment diagramDeployment diagram - - LMSLMS

    LibraryManagement

    Persistence

    Librarian

    Student

    UniversityDB

  • 8/6/2019 UML Test Case

    43/47

    R ational RO SER ational RO SE

    y ROS E = Rational Object Oriented Software E ngineering

    y Rational Rose is a set of visual modeling tools for development of object oriented software.

    y Rose uses the UML to provide graphical methods for non-programmers wanting to model business

    processes as well as programmers modeling applicationlogic.

  • 8/6/2019 UML Test Case

    44/47

  • 8/6/2019 UML Test Case

    45/47

  • 8/6/2019 UML Test Case

    46/47

    y Unified Modeling Language User Guide, Grady Booch

    James Rumbaugh Ivar Jacobson,Addison Wesley

    y Mastering UML with Rational Rose 2002, Wendy Boggs

    y T he Unified Modeling Language Reference Manual,

    James Rumbaugh Ivar Jacobson Grady Booch, Addison

    Wesley

    R eferencesR eferences

  • 8/6/2019 UML Test Case

    47/47