SE 318
SOFTWARE VERIFICATION AND VALIDATION
Online LAB #2
WEEK #8 09.04.2020
REMINDER!!!
• I have created Trello Boards and put the invitation links to the spreadsheet under Project Grades link below.
•
https://docs.google.com/spreadsheets/d/1FRGwyr-4vtYc9fCDrX755CtkRBNGLnHIgDIGQpg5KWc/edit#gid=632150433 • Please use only your group's invitation link and join to Trello Boards.
• After that, enter your requirements to Requirements To Do section in your project board.
ANY QUESTIONS???
• Please check Blackboard and my webpage
(homes.ieu.edu.tr/userhat) periodically for the further announcements.
• Version deadlines (check my webpage)
Review: What is JUnit?
• JUnit is a unit testing framework for the Java Programming Language. • It is important in the test driven development, and is one of a family of
Review: Junit Idea
• JUnit promotes the idea of "first testing then coding", which emphasis on setting up the test data for a piece of code which can be tested first and then can be implemented.
• This approach is like "test a little, code a little, test a little, code a little..." which increases programmer productivity and stability of
Your Turn Now!
TEST TIME
• We are going to test Collaborate for the future online exams.
• Go to Midterm Test from Blackboard menu on the left panel under Panopto Video. • Click to Midterm Test Exam and start doing it.
PASSWORD
Exhaustive Testing is NOT Possible
• Practically, due to time and budget considerations, it is not possible to perform exhausting testing for each set of test data, especially when there is a large pool test cases.
Specification Based Testing Techniques
• Equivalence Partitioning
• Boundary Value Analysis
• Desicion Tables
Specification Based Testing Techniques
• Equivalence Partitioning
• Boundary Value Analysis
• Desicion Tables
Equivalence Partitioning
• It is a black box technique (code is not visible to tester) which can be applied to all levels of testing like unit, integration, system etc.
• In this technique, you divide set of test condition into partition that can be considered the same.
• To get a better idea let see an example.
Example: Flight Reservation Application (cont’d)
• Ticket values 1 to 10 are considered valid & ticket is booked.Example: Flight Reservation Application
Here is the test cases:
1. Any Number greater than 10 entered in the reservation column (let say 11) is considered invalid.
2. Any Number less than 1 that is 0 or below, then it is considered invalid. 3. Numbers 1 to 10 are considered valid 4. Any 3 Digit Number say -100 is invalid.
• We cannot test all the possible values because if done, number of test cases will be more than 100.
• To address this problem, we use equivalence partitioning hypothesis where we divide the possible values of tickets into groups or sets as shown in the next slide where the system behavior can be considered the same.
Example: Flight Reservation Application
Example: Flight Reservation Application
• The divided sets are called Equivalence Partitions or Equivalence Classes.
• Then we pick only one value from each partition for testing.
• The hypothesis behind this technique is that if one condition/value in a partition passes all others will also pass.
• Likewise, if one condition in a partition fails, all other conditions in that partition will fail.
• In Boundary Value Analysis, we test boundaries between equivalence partitions.
• In our earlier example instead of checking, one value for each partition you will check the values at the partitions like 0, 1, 10, 11 and so on. • As you may observe, you test values at both valid and invalid
boundaries.
Your Turn Now!
• Code coverage is a measure which describes the degree of which the source code of the program has been tested.
• It is one form of white-box testing which finds the areas of the program not exercised by a set of test cases.
• It also creates some test cases to increase coverage and determining a quantitative measure of code coverage.
• In most cases, code coverage system gathers information about the running program. • It also combines that with source code information to generate a report about the test
suite's code coverage.
• In this the test case is executed in such a way that every statement of the code is executed at least once.
• Test coverage criteria requires enough test cases such that each
condition in a decision takes on all possible outcomes at least once, and each point of entry to a program or subroutine is invoked at least once.
• That is, every branch (decision) taken each way, true and false.
• It helps in validating all the branches in the code making sure that no branch leads to abnormal behavior of the application.
Path Coverage
• In this the test case is executed in such a way that every path is executed at least once.
• All possible control paths taken, including all loop paths taken zero, once, and multiple (ideally, maximum) items in path coverage technique, the test cases are prepared based on the logical complexity measure of a procedural design.
• In this type of testing every statement in the program is guaranteed to be executed at least one time.
How to Calculate Statement Coverage, Branch
Coverage and Path Coverage?
• Draw the flow in the following way:
Example
Read P Read Q IF P+Q > 100 THEN Print “Large” ENDIF If P > 50 THEN Print “P Large” ENDIFExample (cont’d)
Statement Coverage (SC):
• To calculate Statement Coverage, find out the shortest number of paths following which all the nodes will be covered.
• Here by traversing through path 1A-2C-3D-E-4G-5H all the nodes are covered.
Example (cont’d)
Branch Coverage (BC):
• To calculate Branch Coverage, find out the minimum number of paths which will ensure covering of all the edges.
• In this case there is no single path which will ensure coverage of all the edges at one go.
• By following paths 1A-2C-3D-E-4G-5H, maximum numbers of edges (A, C, D, E, G and H) are covered but edges B and F are left.
• To covers these edges we can follow 1A-2B-E-4F.
• By the combining the above two paths we can ensure of traveling through all the paths.
Example (cont’d)
Path Coverage (PC):
Path Coverage ensures covering of all the paths from start to end. All possible paths
are-1A-2B-E-4F
1A-2B-E-4G-5H
1A-2C-3D-E-4G-5H 1A-2C-3D-E-4F
Example (cont’d)
• Thus for the above example SC=1, BC=2 and PC=4. • Memorize these….
• 100% LCSAJ coverage will imply 100% Branch/Decision coverage. • 100% Path coverage will imply 100% Statement coverage.
• 100% Branch/Decision coverage will imply 100% Statement coverage. • 100% Path coverage will imply 100% Branch/Decision coverage.
• Branch coverage and Decision coverage are same.