Scarica Software engineer .(appunti e spiegazioni) e più Appunti in PDF di Ingegneria del Software solo su Docsity!
Polytechnic of Turin
Master’s Degree in Computer Engineering
Software engineering
lecture notes
Main authors: Lorenzo David, Luca Ghio
Professors: Maurizio Morisio, Marco Torchiano, Luca Ardito
Academic year: 2013/
Version: draft
Date: July 1, 2014
Symbols
= official answer by the professor^1
About this work
This work is published free of charge. You can download the last version of the PDF document, along with the LATEX source code, from here: http://lucaghio.webege.com/redirs/xx This work has not been checked in any way by professors and therefore it may include mistakes. If you find any of them, you are invited to directly fix them by yourself by making a commit to the public Git repository, or alternatively you can contact the main authors by sending an e-mail to [email protected] or [email protected].
License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License (pictures, unless otherwise specified, are licensed under this license too). You are free to:
- share: copy and redistribute the material in any medium or format;
- adapt: remix, transform, and build upon the material;
for any purpose, even commercially, under the following terms:
- Attribution: you must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use;
- ShareAlike: if you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
(^1) This image is taken from Wikimedia Commons (Artículo bueno.svg), it was made by user Paintman and by user Ignacio Icke and it is in the public domain.
9.1.2 The cost of fixing a defect in a requirements document is higher if the
Part I
Theory summary
Chapter 1
Requirement engineering
1.1 Phases of requirement engineering
- Elicitation: extract information from customer about what he actually needs.
- Informal description
- Analylisis and formalization
- Requirement document: this marks the contract between the customer and the developers.
- Inspection reading
1.2 Key concepts
Stakeholder role or person with an interest (stake) in the system to be built.
- User
- Buyer
- Administrator
- Analyst
- Developer
Requirement description of a system/service and of its contraints. Requirement can be spec- ified by the:
- user (user requirements): statements in natural language, services offred by the system and operational constraints.
- developer (system requirements): structured document setting out detailed descriptions of the system’s functions. This is generally part of the contract between client and the contractor.
Functional requirement Statements of service the system should provide.
- how the system should react to particular inputs
- how the system should behave in particular situations
- Traceable: it answers the customer or the user need to determine if the requirement correctly reflects their actual needs. - Backward traceability: explicitly referencing source in earlier documents, in order to be able to understand why something has been written. - Forward traceability: unique name or reference number, in order to be able to see the correspondance of the requirement in the implemented code.
Note on conflicts :
- completeness and consistency are in conflict.
- ranking has different priority depends if it is from the point of view of the developer or the user.
1.2.1 Defects in a requirement
- Omission/incompleteness: if a requirement is missing, it will not be implemented
- Incorrect fact: requirement contradicted by the empirical world
- Inconsistency/contradiction: implemented in the wrong way
- Ambiguity
- Extraneous information (overspecification): requirement that should not be in requirement document (e.g. design specification)
- Redundancy
1.3 IEEE STD 830
- Introduction - Purpose - Scope - Definitions - References - Overview
- Overall description - Product perspecetive (the context) - Product functions - User characteristics - Constraints - Assumptions and dependencies
- Specific requirements - External interfaces - Functions - Performance requirements - Logical db requirements - Other NF requirements
- Appendixes
- Index
1.4 ISO 9126
This standard considers the system alone.
- Purpose: how much of the required test cases are covered by the test plan?
- Method of application: count the number of test cases planned and compare it to the number of test cases required to obtain adequate test coverage
- Definition: X = A/B - A = number of test cases designed in test plan and confirmed in the review - B = number of test cases required
- Interpretation: 0 ≤ X , where X is the greater the better adequacy
1.5 Organization of the requirements
- Mode
- User class
- Object
- Feature
- Stimulus
- Functional hierarchy
1.6 Guidelines for requirements
- define a standard format
- define a clear language
- use them in a consist way
- highlight the key parts of the requirement
- avoid the usage of computer jargon
1.7 Requirement techniques
- Context diagram
- Glossary
- Class diagram
- Requirement numbering and type
- Use case diagram
- Scenario and sequence diagram
- System diagram
Chapter 2
Use case
2.1 Definition
Use case The use case captures a contract between the stakeholders of a system about its behavior, describing the system’s behavior under various conditions as it responds to a request. A use case describes a goal -oriented set of interactions between external actors and the system under consideration.
- The primary actor initiates an interaction with the system to accomplish some goal
- The system responds, protecting the interests of all the stakeholders
The main purpose is to describe the business’ work process, focusing on the discussion about up coming software system requirements (it’s not a requirements description substitute).
Relationship between requirements and use cases They can represent the functional be- havioral requirements, if written properly. Use cases are very useful for highy interactive systems, as they describe the interaction between the user and the system. In comparisson to requirements, use cases lacks of:
- external interfaces
- data formats
- business rules
Actor An actor is an external entities with respect to the system.
- primary actor is has a goal requiring the assistance of the system
- secondary actor is one from which the system needed assistance
Goals The use case cares only what is the relationship of the actor to the system. The goal must be of value to the primary actor (e.g. “Enter the PIN code” is NOT a goal, while “Withdraw cash” is 312223a goal).
2.2 Advantages and disadvantages of redacting a use case
document
Advantages
- Representation of the functional behavioral requirements
- Appropriate for highly-interactive systems (they describe the interaction between the user and the system)
- Representing a functional goal that a primary actor wants to achieve using the system
Disadvantages
- Missing - External interfaces - Data formats - Business rules
2.3 Scope
The extent of what we consider to be designed by us (not already existing, not someone else’s design job)
- In-out list: deciding with the customer if the functionality has to be inside or outside our scope
- Actor-goal list (it’s also possible to add priority as well)
- use case briefs (short summary)
2.4 Measures
- Precision
- Actors and goals: prioritized list of actors and their goals
- Failure conditions: list of all possible failures
- Failure handling: how to respond to each failure
- Granularity - Summary level: high level - User-goal level: medium level, most important - Subfunction: low level, necessary but not relevant for the user
2.5 Template for a use case
- Use case : name of the use case. This is the goal stated by a short active verb phrase.
- Scope : the scope of the “system” being considered
- Level : summary, user-goal, or subfunction
- Intention in context : a statement of the primary actors intention and the context within which it is performed.
- Primary actor : the primary actor of the use case.
- Main Success Scenario : the numbered steps of the scenario, from trigger to goal delivery, followed by any clean-up.
- Extensions To describe secondary cases (e.g. something unexpected happens).
- Extension
- An extend relationship from use case A to use case B indicates that an instance of use case B may be augmented by the behavior specified by A
- The behavior is inserted at the location defined by the extension point in B, which is referenced by the exted relationship
Chapter 3
Verification and Validation
3.1 Whole picture
- requirement
- design
- implementation
- integration
Each step can be verificated and validated. The cost of fixing defect increases the more the project reaches its end (from requirement to the final deliverable).
3.1.1 Goal of the VV
- Minimize the number of defects inserted
- Maximize the number of defects discovered and removed
- Minimize the time span between insertion, discovery and removal
3.1.2 Techniques used in VV
3.2 Static (inspection, source code analysis)
- Reading document, by group of people, in order to find defects (without correctin them)
- Fagan inspection process
- Planning: select team, arrange materials, schedule dates
- Overview: present process, product
- Preparation: become familiar with the product
- Inspection meeting: team analysis to find defects (not fix them)
- Rework: correct defects
- Follow up: verify fixes, collect data
- Ad hoc: just read it
3.2.4 Prerequisites for successful inspections
- Document under inspection meets quality standards
- Results not used to evaluate people (and notably author)
- Constructive approach
- Find defects, not fix them
3.3 Dynamic (testing)
3.3.1 Test case
- name
- input
- expected output (given by an oracle )
- test case / test suite
3.3.2 Test case log
- Time and date of application
- Actual output
- Result (pass/no pass)
3.3.3 Test case activities
- Write a test case (or suit)
- Run the test case (or suit)
- Record results in the Test case log
3.3.4 Test case classification
- Per phase/granularity level - Unit: testing individual modules - Integration: testing the link among modules. First test every unit alone, then add one unit at a time - System: testing the system as a whole - Regression: seeks to uncover new software bugs, or regressions, in existing functional and non-functional areas of a system after changes such as enhancements, patches or configuration changes, have been made to them.
- Per approach - Black box (functional) ∗ random
· pro: indipendent of requirements · cons: requires many test cases (requires Oracle) ∗ equivalence classes partitioning · a class corresponds to set of valid of invlid inputs for a condition on the input variables · if a test in a class has not success the other tests in the same class may have the same behavior · partitions must not overlap, and must span the whole input space · boundary between partitions · take test cases on the boundary · every equivalence class must be covered by a test case at least · when a module has a state, the state has to be considered to define the partitions.
- White box (structural) ∗ coverage of structural elements: · statement · node (node can be collapsed in basic block, which only has one entry point and one exit point) · decision · condition (each condition is forced at least once to true and at least once to false, but we are considering one condition at a time without considering all the combinations) · path (a path is a sequence of nodes in a graph; it’s almost impossible to get full path coverage if the graph has cycles) · loop (select test cases such that every loop boundary and interior is tested; each loop must be considered separately)
- do not enter the loop
- cycle once in the loop
- cycle more than once - Reliability assessment/predication - Risk based (safety security)
- Mutation testing: introduce a change in the code (usually performed for hardware valida- tion).
- write test cases
- inject errors in the program (single small change)
- verify if test cases catch the errors injected
3.3.5 Test case goal
- The pupose of testing process is to find defects in the software products.
- A test is succesful if it reveals a defect.
- The process of operating a system a or component under specified conditions observing or recording the results to detect the differences between actual and required behavior.