Lecture 3: Introduction to Giới thiệu về
kiểm thử phần
Software Testing mềm
IT4501
Bùi Thị Mai Anh (anhbtm@[Link])
Bộ môn Công nghệ phần mềm
Viện công nghệ thông tin và truyền thông
Contents 2
• Definition and Motivation of Software Testing
• Basic terms of Software Testing
• Test Activities
• Test Levels
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
What is software testing? 3
• IEEE defines software testing as:
• "A process of analyzing a software item to detect the difference
between existing and required conditions
(defects/errors/bugs) and to evaluate the features of the
software item"
• Note that...
• ...one needs to know the required conditions
• ...one needs to be able to observe the existing conditions
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Software Testing is a process 4
• Evaluating a program or a system
• Verify that the product is right
• Validate that the right product is developed
• Evaluate the product quality
• Find defects
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Testing takes time 5
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
It does It does
work not work
Objectives of
Testing Reduce
Reduce
the cost
the risk
of
of failure
testing
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19 6
Test case
Trường hợp kiểm thử/Ca kiểm thử 7
• Simply, a pair of <input, expected outcome>
• Example: a square root function of nonnegative numbers
• Two kinds of testing function
• stateless function/system
• example: compiler
• state-oriented system
• example: ATM machine to withdraw function
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Expected Outcome 8
• An outcome of program execution may include
• Single values produced by the program
• State changes
• Sequence or set of values which must be intepreted together for the outcome to be
validated
• The concept of oracle in test designing: any entity (program, process,
body of data...) producing the expected outcome of a particular test
• Expected outcome should be computed when designing test case
• Without executing program but using program’s requirements/specifications
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Complete Testing
Hoàn tất kiểm thử 9
• Complete Tesing means:
• There are no undiscovered faults at the end of the test phase
• It is impossible to complete testing for most of the software
systems
• Domain of possible inputs of a program is too large to be completely
used in testing
• valid and invalid values of data input
• Design issues may be too complex to completely test
• Impossible to create all possible execution environments of the
system
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Centre Issue in Testing
Vấn đề trung tâm của kiểm thử 10
• Select a subset of the input domain to
test a program
• Let D be the input of the program P
• Select subset D1 ⊂ D to test P: D1
exercise only in part P1 ⊂ P (the
execution behavior of P) • Selection of a subset of input domain should be
done in a systematic and careful manner so that
• We said that we were attempting to the deduction is as accurate and complete as
deduce properties of P on selected possible
inputs D1 • The idea of coverage is considered while
selecting test cases
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Testing Activities
Các hoạt động kiểm thử
• Identifying an objective to be
tested
• Select inputs
• Compute the expected
outcome
• Setup the execution
environment of the program
• Execute the program
• Analyze the test result
• Writing test report if test case
is failed
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19 11
Test Levels
Mức độ kiểm thử
• Testing is performed at
different levels involving
the whole system or parts
of it throughout the life
cycle of a software
product
• Four stages of testing
• Unit test
• Integration test
• System test
• Acceptance test
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19 112
Regression Test
Kiểm thử hồi quy 13
• Subphase of unit/integration/system testing
• Performed whenever a component is modified
• To ensure that no new faults are introduced becaused of performed
modifications
• No new tests are considered but tests are selected, prioritized and
executed
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Acceptance Test
Kiểm thử chấp nhận 14
• Objective of acceptance testing is to measure the quality of the product
rather than searching for the defects
• Based on expectations of customers
• 2 kinds of acceptance testing
• User acceptance testing (UAT)
• Busineess acceptance testing (BAT)
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Sources of Information for Test Case
Nguồn dữ liệu sử dụng để thiết kế ca kiểm thử 15
• Objective of designing test cases: generate effective tests at a lower cost
• Sources of Information:
• Requirements and functional specifications
• Source code
• Input and Output domains
• Operational Profile
• Fault Model
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Requirements and Functional Specifications 16
• The process of software development begins by capturing user needs
• The number of user needs identified at the beginning depends on the
specific life-cycle model
• ex: waterfall vs agile
• Test case designing is performed based on software requirements
• Requirements can be specified in different manners
• Plaintext, equations, figures, flowcharts...
• Use cases, entity-relationship diagrams, class diagrams
• Using formal language and notation as finite-state machine...
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Source Code 17
• Requirement specifications describe the intended behavior of a system
• Source Code describes the actual behavior of the system
• Test cases must be designed based on the program
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Input and Output domains 18
• Input domain
• Valid data and Invalid data
• Some values in the input domain may have special meanings and should
be treated separately
• Special values in the input and output domains of a program should be
considered while testing the program
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Operational Profile 19
• Operation/Usage profile is a quantitative characterization of how a
system will be used
• It is important to test a system by considering the ways it will actually be
used
• To guide test engineers in selecting test cases using samples of system
usage
• Test inputs are assigned a probability distribution or profile according to
their occurrences in actual operation
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Fault Model 20
• Encountered faults are a excellent source of information in designing new
test cases
• Different classes of faults: initialization faults, logic faults, interface faults
• 3 types of fault-based testing:
• Error guessing
• Fault seeding
• Mutation testing
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Test case designing techniques 21
• White Box Testing
• Structural testing techniques
• Examining source code with a focus on control flow and data flow
• Applied to individual units of a program
• Black Box Testing
• Functional testing techniques
• Examining functional specifications of testing modules
• Applied to both an entire system and the individual program units
• These strategies are used by different groups of people at different times
during a software life cycle
• Ex: programmers use both to test their own code while quality assurance engineers
apply the idea of functional testing
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Test Planning and Design 22
• The purpose of system test planning is to get ready and organized for
test execution
• Test plan provides a framework, scope, details of resource needed, effort
required, schedule of activities and a budget
• Test design is a critical phase of software testing
• System requirements are critically studied
• System featured to be tested are identified
• Objectives and detailed behaviors of test cases are defined
• Test-Driven Development (TDD): test cases are designed and
implemented before the production code is written
• key practice of modern agile software development processes
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Monitoring and Measuring test execution 23
• Motivation: to explore the progress of testing and reveal the quality level
of the system
• Test execution metrics are categorized into 2 classes
• Metrics for monitoring test execution
• Metrics for monitoring defects
• Quantitative measurements
• Number of defects detected by test cases
• Number of test cases designed/executed per day
• Number of defects found by the customers that were not found by the test
engineers
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19
Summary 24
• Students should understand principle terms of software testing
• Have a general understand of V-model
• Understand different phase/activities of testing process
IT4501 - Software Engineering Department - SoICT/HUST 3/7/19