• Tidak ada hasil yang ditemukan

A Practitioner's Guide to Software Test Design @Team LiB

N/A
N/A
Nguyễn Gia Hào

Academic year: 2023

Membagikan "A Practitioner's Guide to Software Test Design @Team LiB"

Copied!
355
0
0

Teks penuh

A Practitioner's Guide to Software Test Design illustrates each test design approach through detailed examples and step-by-step instructions. Instructors and professors looking for an excellent reference for a course in software test design techniques.

Appreciation

Some Final Comments

Acknowledgements

The Testing Process

Overview

Testing

It's a mental discipline that results in low-risk software without a lot of testing effort." At this maturity level we focus on making the software more testable from the start. In addition, this means writing code that includes objects that the tester can easily use.

Current Challenges

Test Cases

Inputs

Outputs

Order of Execution

The disadvantage is that each test tends to be larger and more complex, making it more difficult to design, create, and maintain.

Types Of Testing

Testing Levels

From a seller's perspective, we would generally want the minimum level of testing possible that would result in money changing hands. Typical strategic questions to be addressed before acceptance testing are: Who determines the level of acceptance testing.

The Impossibility Of Testing Everything

Summary

Practice

Case Studies

Why Case Studies?

Brown & Donaldson

Stateless University Registration System

Black Box Testing Techniques Chapter List

Part Overview

Definition

Applicability

Disadvantages

Advantages

Equivalence Class Testing

On the fourth day of his exploration of the Amazon, Byron climbed out of his inner tube, checked the latest news on his personal digital assistant (hereinafter PDA) equipped with wireless technology, and realized that the gnawing he felt in his stomach was not fear. .

Introduction

In the project-by-contract approach, modules (called "methods" in the object-oriented paradigm, but "module" is a more general term) are defined in terms of preconditions and post-conditions. If we use design-by-contract and test-by-contract, the answer is No.

Technique

Each of these data values ​​is within the valid range, so we expect the system to work correctly and the test case to report Pass. This is a good design choice because it reduces the number of test cases the tester has to create.

Figure 3-2: Discrete equivalence classes  For a valid input we might choose two houses
Figure 3-2: Discrete equivalence classes For a valid input we might choose two houses

Applicability and Limitations

Boundary Value Testing

Boundary testing focuses on boundaries because that's where so many bugs hide. Boundary testing focuses on boundaries because that's where so many bugs hide.

Figure 4-1: Boundary values for a continuous range of inputs.
Figure 4-1: Boundary values for a continuous range of inputs.

Decision Table Testing

Decision tables are an excellent tool for capturing certain types of system requirements and documenting the internal design of the system.

Rule 2 Rule 3 Rule 4 Conditions

Each rule causes an action to "fire". Each rule can specify an action unique to that rule, or rules can share actions. In this situation, the selection of test cases is simple - each rule (vertical column) becomes a test case. If the system under test has complex business rules, and if your business analysts or designers have not documented these rules in this form, testers should collect this information and.

In this way, we merge the ideas from Boundary Value testing with Decision Table testing.

Table 5-3: Adding a single action to a decision table.
Table 5-3: Adding a single action to a decision table.

Rule 2 Rule 3 Rule 4 Rule 5 Rule 6 Rule 7 Rule 8 Conditions

Referring to the trading web page of the Brown & Donaldson website described in Appendix A, consider the rules associated with a buy order.

Rule 2 Rule 3 Rule 4 Rule 5 Conditions

No No No No No No No No No Yes Yes Yes Yes Yes Yes Yes. No No No No Yes Yes Yes Yes No No No No Yes Yes Da. Spremeni No No Da Da No No Da Da No No Da Da No No Da.

Student No No No No No No Yes No No No Yes No No No.

Table 5-10: A further collapsed decision table reflecting "Don
Table 5-10: A further collapsed decision table reflecting "Don't Care" conditions.

Pairwise Testing

Each has such a large number of combinations that we may not have the resources to construct and run all the tests, there are just too many. If a system had four different input parameters and each could take one of three different values, the number of combinations is 34 which is 81. If a system had twenty different input parameters and each could take one of ten different values, the number of combinations is 1020.

Two different techniques are used to identify all pairs for creating test cases - orthogonal arrays and the Allpairs algorithm.

Orthogonal Arrays

Examine columns 1 and 2 - do all nine combinations of 1, 2 and 3 appear in this pair of columns. Now examine columns 1 and 3 - whether the nine combinations of 1, 2 and 3 appear in this pair of columns. The array L9(34) is rectangular; that is, if you choose any two columns, all combinations will appear in all pairs of columns.

An orthogonal array is a two-dimensional array of numbers that has this interesting property - select any two columns in the array.

Figure 6-1: Orthogonal array notation  Let
Figure 6-1: Orthogonal array notation Let's consider a larger orthogonal array. Given the numbers 1, 2 and 3, how many pair combinations of 1, 2, and 3 exist? {1,1}, {1,2}, {1,3}, {2,1}, {2,2}, {2,3}, {3,1}, {3,2}, and {3,3}

Using Orthogonal Arrays

Find an orthogonal array that has a column for each variable and the values ​​within the columns that correspond to the choices for each variable. Let's run the process step by step using an orthogonal array to select test cases. Find an orthogonal array that has a column for each variable and the values ​​within the columns that correspond to the choices of each variable.

Now, all that remains is to build a test case for each row in the orthogonal array.

Table 6-5: L 64 (8 2 4 3 ) Orthogonal Array
Table 6-5: L 64 (8 2 4 3 ) Orthogonal Array

Allpairs Algorithm

Win NT Netscape 6.1 Win 2000

Then run the Allpairs program by typing: allpairs input.txt > output.txt where output.txt will contain a list of all test case pairs. The "unbalanced" nature of the all-pair selection algorithm requires only forty-eight test cases, a 25% savings. Proponents of the Allpairs algorithm point out that, given a problem with 100 parameters, each of which can take one of two values, 101 test cases using the (balanced) orthogonal array would be required, while the unbalanced all-pairs approach requires only ten tests. .

Since many applications have large numbers of inputs that each take only a few values, they argue that the all-pairs approach is better.

Table 6-12: Output from the Allpairs program.
Table 6-12: Output from the Allpairs program.

Final Comments

State-Transition Testing

Colonel Cleatus Yorbville was one seriously bored astronaut for the first few months of his diplomatic mission on the third planet of the Frangelicus XIV system, but everything changed the day he discovered that his tiny, multi-footed and infinitely hospitable alien hosts not only edible, but tasted remarkably like that stuff left on the pan after you've made cinnamon buns and burned them a bit. State transition diagrams, such as decision tables, are another excellent tool for capturing certain types of system requirements and documenting internal system design. These diagrams document the events that come in and are processed by a system as well as the system's responses.

When a system needs to remember something that happened before or when valid and invalid orders of operations exist, state transition diagrams are excellent tools to capture this.

State-Transition Diagrams

It describes the states of a reservation, the events that affect the reservation, the transitions of the reservation from one state to another, and the actions initiated by the reservation. If the Booking is not paid within the specified time (PayTimer expires), it is canceled for non-payment. From the situation made, the customer (through the booking agent) requests to cancel the Booking.

The airline generates a refund, but only when it receives the printed ticket from the customer.

Figure 7-2: The Reservation transitions to the Paid state.
Figure 7-2: The Reservation transitions to the Paid state.

State-Transition Tables

As described, state transition diagrams express complex system rules and interactions in a very compact notation. The advantage of a state transition table is that it lists all possible state transition combinations, not just the valid ones. In addition, creating a state transition table often reveals combinations that were not identified, documented, or addressed in the requirements.

Using a state transition table can help detect implementation errors that allow invalid paths from one state to another.

Creating Test Cases

Domain Analysis Testing

Like these techniques, we look for situations where the boundary has been set or implemented incorrectly. An entry point is a value that meets all boundary conditions but does not lie on the boundary. When a boundary is open (defined by the < or > inequality operator) so that points on the boundary are not included in the domain, then a point on the boundary lies on the boundary but is not included in the domain.

Like those techniques, we look for situations where the boundary is incorrectly implemented.

Figure 8-1: Two dimensional boundary defects.
Figure 8-1: Two dimensional boundary defects.

Use Case Testing

Note that the use case is defined from the perspective of the user, not the system. Prerequisites The required state of the system before the use case is triggered. Success End. Conditions State of the system after successful completion of this use case Failed End.

Make sure you have at least one test case for each extension in the use case.

Figure 9-1: Some Stateless University use cases.
Figure 9-1: Some Stateless University use cases.

White Box Testing Techniques Chapter List

Control Flow Testing

Unfortunately, in any interesting enough module, trying to fully test all control flow paths has a number of significant drawbacks. The number of paths may be large and thus unprovable within a reasonable amount of time. Each decision doubles the number of paths, and each loop multiplies the paths by the number of iterations through the loop.

Although control flow testing has a number of drawbacks, it is still a vital tool in testing.

Control Flow Graphs

Process Blocks

Decision Point

Junction Point

Levels of Coverage

At this level, enough test cases are written so that every decision that has a TRUE and FALSE outcome is evaluated at least once. 34;100% condition coverage." At this level, enough test cases are written so that every condition that has a TRUE and FALSE outcome that constitutes a decision is evaluated at least once. We can achieve condition coverage with two test cases (x= TRUE , y=FALSE and x=FALSE, y=TRUE), but note that with these choices of data values ​​the .

Finally, we reach the highest level, which is "100% path coverage". For code modules without loops, the number of paths is generally small enough for a test case.

Figure 10-2: Graphical representation of the two-line code snippet.
Figure 10-2: Graphical representation of the two-line code snippet.

Structured Testing / Basis Path Testing

ABDP 2. ACDP

ABDEFGMODP 4. ABDEFHKMODP

Additionally, control flow testing can be very time-consuming due to all the modules and underlying paths that make up the system. Control flow testing identifies execution paths through a module of program code and then creates and executes test cases to cover those paths. Since the set of basic paths covers all edges and nodes of the control flow graph, meeting this structured testing criterion automatically ensures branch and statement coverage.

Create the control flow diagram, determine its cyclomatic complexity, select a set of base paths, and determine the necessary values ​​for the conditions to sensitize each path.

Table 10-1: Data values to sensitize the different control flow paths.
Table 10-1: Data values to sensitize the different control flow paths.

Data Flow Testing

Naive developers unconsciously assume that the language compiler or runtime system will set all variables to null, blanks, TRUE, 42, or whatever later in the request program. Data flow testing is a powerful tool for detecting misuse of data values ​​due to coding errors. In both uses, it is equally important that the variable has been assigned a value before use.

We will construct these diagrams and check that the define-use-kill patterns are appropriate.

Static Data Flow Testing

For each variable in the module, we will examine define-use-kill patterns along the control-flow paths. In the general case, static analysis cannot determine whether the define-use-kill rules have been followed correctly unless each element is considered individually. In this case, an incorrect define-use-kill combination may exist, but never will.

In systems that process interrupts, some of the define-use-kill actions may occur at the interrupt level while other define-use-kill actions occur at the main processing level.

Figure 11-1: The control flow diagram annotated with define-use-kill information for each of the module
Figure 11-1: The control flow diagram annotated with define-use-kill information for each of the module's variables.

Dynamic Data Flow Testing

Like control flow testing, data flow testing can be very time consuming due to all the modules, paths, and variables that make up a system. A data flow chart is similar to a control flow chart in that it shows the flow of processing through a module. We will use these diagrams to verify that the define-use-kill patterns are appropriate.

34;Data Flow Analysis Techniques for Test Data Selection.” Sixth International Conference on Software Engineering, Tokyo, Japan, September.

Testing Paradigms Chapter List

Paradigms

Test Planning

Scripted Testing

Gambar

Table 3-5: A set of test cases varying invalid values one by one.
Table 5-6: Sample test cases.
Table 5-7: A decision table converted to a test case table.
Table 5-10: A further collapsed decision table reflecting &#34;Don't Care&#34; conditions.
+7

Referensi

Dokumen terkait

The New Order government in the era is at its peak to build and design in such a way the educational system in this country correspond to the need of industrial and development which