Documente Academic
Documente Profesional
Documente Cultură
Cseg5325
By Esubalew A.
Contents
Boundary
BVA:
value analysis
Testing Techniques
Testing, however creative and seemingly complete, cannot guarantee the absence of all errors. Test-case design is so important because complete testing is impossible; the obvious strategy, then, is to try to make tests as complete as possible. Given constraints on time and cost, the key issue of testing becomes What subset of all possible test cases has the highest probability of detecting the most errors? The study of test-case-design methodologies supplies answers to this question.
Testing Techniques
The main objective of test case design techniques is to design an effective test cases. If test cases are effective there is
a
greater probability of detecting/revealing defects a more efficient use of organizational resources a higher probability for test reuse closer adherence to testing and project schedules and budgets, and the possibility for delivery of a higher-quality software product.
Testing Techniques
Test case design techniques are the heart of testing. There are many advantages of using techniques to design test cases.
Support
systematic and meticulous work and make the testing specification effective and efficient; Extremely good for finding possible faults. the design of the test cases may be repeated by others that it is possible to explain how test cases have been designed using techniques.
Testing Techniques
Test case design techniques have a few pitfalls that we need to be aware of.
Even
if we could obtain 100% coverage of what we set out to cover (be it requirements, or statements, or paths), faults could remain after testing simply because the code does not properly reflect what the users and customers want. Validation of the requirements before we start the dynamic testing can mitigate this risk. value sensitivity. Even if we use an input value that gives us the coverage we want it may be a value for which incidental correctness applies.
What are the approaches a tester should use to design effective test cases? There are two basic strategies that can be used to design test cases.
Black
box /functional/behavioural / specificationdriven/data-driven / input output driven test strategy treats the system as a "black-box", so it doesn't explicitly use knowledge of the internal structure, to design test cases White box /clear box/ glass box /structural test strategy allows one to peek inside the "box", and it focuses specifically on using internal knowledge of the software to guide the selection of test data.
These techniques focus on the functionality. Involves deriving tests from external descriptions of the software, including specifications, requirements, and design.
Unlike
its complement, white box testing, black box testing requires no knowledge of the internal paths, structure, or implementation of the software under test (SUT).
Aims at finding cases in which the software does not behave according to its specifications or requirements The general black box testing process is:
The
inputs are chosen based on the specification to determine that the software under test (SUT) processes them correctly. Invalid inputs must also be chosen to verify that the SUT detects them and handles them properly. Expected outputs for those inputs are determined. Tests are constructed with the selected inputs. The tests are run. Actual outputs are compared with the expected outputs. A determination is made as to the proper functioning of the SUT.
These test case design techniques can be used in all stages and levels of testingunit, integration, system, and acceptance.
Though the size increases from module to subsystem and then to system the box gets larger, with more complex inputs and more complex outputs, the approach remains the same. Also, as we move up in size, we are forced to the black box approach; there are simply too many paths through the SUT to perform white box testing.
Advantages
Tester can be non-technical. Used to verify contradictions in actual system and the specifications. Test cases can be designed as soon as the functional specifications are complete directs the tester to choose subsets of tests that are both efficient and effective in finding defects - helps maximize the return on our testing investment
Disadvantages
The tester can never be sure of how much of the system under test has been tested. i.e. chances of having unidentified paths during this testing The test inputs needs to be from large sample space. It is difficult to identify all possible inputs in limited testing time.
is to effectively use the resources available by developing a set of test cases that gives the maximum yield of defects for the time and effort spent
To achieve this goal there are various functional test case design techniques. Reading Assignments
Random Testing Equivalence partitioning Boundary value analysis Decision tables Cause-effect graph State transition testing
Error Guessing Classification tree method Pair-wise testing Use case testing Domain analysis
Very often combinations of the methods are used to detect different types of defects.
Random Testing
Each software module or system has an input domain from which test input data is selected. If a tester randomly selects inputs from the domain, this is called random testing.
E.g.
If input domain for a module is 1-100 a tester may choose 24, 53 & 7 as input values. But Are the three values adequate to show that the module meets its specification when the tests are run? Are there any input values, other than those selected, more likely to reveal defects? Should any values outside the valid domain be used as test inputs?
Random Testing
Use of random test inputs may save some of the time and effort that more thoughtful test input selection methods require. However, selecting test inputs randomly has very little chance of producing an effective set of test data. There are tools that generate random test data for stress tests. This type of testing can be very useful especially at the system level. Usually the tester specifies a range for the random value generator, or the test inputs are generated according to a
Involves partitioning the input or output domain into equivalence classes. Though not always this is possible most of the times.
Partitioning is splitting the domain into classes such that all members of the domain belong to exactly one class i.e. no member belongs to more than one class and no member falls outside the classes. Class is a portion of the domain. Equivalence refers to the assumption that all the members in a class behave in the same way.
The reason for the equivalence partitioning is that all members in an equivalence class will either fail or pass the same test.
When SUT domain is partitioned into equivalence classes, usually both valid and invalid classes are obtained.
Test cases should be designed for both the valid and the invalid classes but sometimes it is not possible to execute test cases based on the invalid equivalence classes.
Partitioning of the input domain for the SUT using this technique has the following advantages:
It eliminates the need for exhaustive testing, which is not feasible. It guides a tester in selecting a subset of test inputs with a high probability of detecting a defect. It allows a tester to cover a larger domain of inputs/outputs with a
1,300 or more, but less than Based on the above table 3 valid and 40 invalid equivalent 3 5,000 classes can be found
Valid Equivalent Classes Values between 0 to 500, 500 to 1000 and 1000 to 5000 Invalid Equivalent Classes Values less than 0, greater than 5000 and inputs containing letters
The following conditions can be used as guidelines for selecting input equivalence classes
If
range of values, select one valid equivalence class that covers the allowed range and two invalid equivalence classes, one outside each end of the range. a number of values, then select one valid equivalence class that includes the allowed number of values and two invalid equivalence classes that are outside each end of the allowed number. a set of valid input values, then select one valid equivalence class that contains all the members of the set and one invalid equivalence class for any value outside the set
the input specification or any other information leads to the belief that an element in an equivalence class is not handled in an identical way by the SUT, then the class should be further partitioned into smaller equivalence classes
The input conditions are that the variable x must be a real number and be equal to or greater than 0.0. The conditions for the output variable y are that it must be a real number equal to or greater than 0.0, whose square is approximately equal to x. If x is not equal to or greater than 0.0, then an exception is raised. From this information the tester can easily generate both invalid and valid equivalence classes and boundaries. For example, input equivalence classes for the specification in previous slide is
EC1. The input variable x is real, valid EC2. The input variable x is not real, invalid
After the equivalence classes have been identified in this way, the next step in test case design is the development of the actual test cases A good approach includes the following steps.
Assigned a unique identifier for each equivalent classes Develop test cases for all valid & invalid equivalence classes until all have been covered by a test case
The equivalence partition coverage is measured as the percentage of equivalence partitions that have been exercised by a test
can significantly reduce the number of test cases that must be created and executed. most suited to systems in which much of the input data takes on values within ranges or within sets. makes the assumption that data in the same equivalence class is, in fact, processed in the same way by the system. The simplest way to validate this assumption is to ask the programmer about their implementation. Equivalence class testing is equally applicable at the unit, integration, system, and acceptance test levels. All it requires are inputs or outputs that can be partitioned based on the system's requirements.
Equivalence classes of intervals have boundaries, but those of lists do not. Boundary value analysis is the process of identifying the boundary values. The boundary values require extra attention because defects are often found on or immediately around these. Choosing test cases based on boundary value analysis insures that the test cases are effective.
The rules-of-thumb described below are useful for getting started with boundary value analysis.
values, develop valid test cases for the ends of the range, and invalid test cases for possibilities just above and below the ends of the range.
For
interval classes with precise boundaries, it is not difficult to identify the boundary values. If a class has an imprecise boundary (> or <) the boundary value is one increment inside the imprecise boundary.
If
an input condition for the SUT is specified as a number of values, develop valid test cases for the minimum and maximum numbers as well as invalid test cases that include one lesser and one greater than the maximum and
the input or output of the software-under-test is an ordered set, such as a table or a linear list, develop tests that focus on the first and last elements of the set.
The boundary value coverage is measured as the percentage of boundary values that have been exercised by a test. Note that
Equivalence
class partitioning and boundary value analysis apply to testing both inputs and outputs of the softwareunder-test Conditions are not combined for equivalence class partitioning or boundary value analysis.
Given the following user requirements find test conditions and test cases for the testing of the requirement.
[UR 631] The system shall allow shipments for which the price is less than or equal to 100.
Lets do this using a template designed by Carsten Jrgensen The design of the test conditions based on equivalence class partitioning and boundary value analysis can be captured in a table such as the following one
To design the test cases The first thing well do is fill in the header of the design table. The next thing is identifying the valid class(es).
If we want 100% equivalence partition coverage and two value boundary value coverage for the requirement, assuming that invalid values are rejected, we get the following test cases:
We can omit some of the test cases, especially since there are actually 5 different test cases covering the same equivalence class.
Example 2 on BVA
The test design table looks like this after the analysis.
This type of equivalence class does not have boundaries. The test cases could be:
Suppose we want to test a module that allows a user to enter new student identifiers into a student data base. The input specification for the module states that a widget identifier should consist of 315 alphanumeric characters of which the first two must be letters Three separate conditions that apply to the input
1.
2.
3.
It must consist of alphanumeric characters The range for the total number of characters is between 3 and 15 The first two characters must be letters
First identify input equivalence classes and give them each an identifier
Condition 1: alphanumeric
EC1. Part name is alphanumeric, valid. EC2. Part name is not alphanumeric, invalid.
Condition 3
EC6. The first 2 characters are letters, valid. EC7. The first 2 characters are not letters, invalid.
Boundary value analysis is now used to refine the results of equivalence class partitioning. The following bounds groups are identified and represented by abbreviations.
BLBa value just below the lower bound (e.g. 2 ) LBthe value on the lower boundary (e.g. 3 ) ALBa value just above the lower boundary (e.g. 4 ) BUBa value just below the upper bound (e.g. 14 ) UBthe value on the upper bound (e.g. 15 ) AUBa value just above the upper bound (e.g. 16 )
Then we will augment these with the results from boundary value analysis. If the tester does not believe in them he or she may omit bounds groups except LB & UB, as they are included in either valid or invalid equivalent classes Finally, the test case design process is to select a set of actual input values that covers all the equivalence classes and the boundaries. The table in the next slide is used to organize the results. The table only describes the tests for the module in terms of inputs derived from equivalence classes and boundaries.
Boundary value testing can significantly reduce the number of test cases that must be created and executed. It is most suited to systems in which much of the input data takes on values within ranges or within sets. Boundary value testing is equally applicable at the unit, integration, system, and acceptance test levels. All it requires are inputs that can be partitioned and boundaries that can be identified based on the system's requirements.