Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Summary of the most complete test case design method in history

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

The Design method of Test case (complete)

Equivalence class division method:

one。 Brief introduction of the method

1. Define

It divides all the possible input data, that is, the input field of the program, into several parts (subsets), and then selects a small number of representative data from each subset as test cases. This method is an important and commonly used black box test case design method.

two。 Divide equivalence classes:

An equivalence class is a subset of an input field. In this subset, each input data is equivalent for exposing errors in the program, and it is reasonably assumed that testing the representative value of a certain equivalence class is equal to testing other values of this class, therefore, all the input data can be reasonably divided into several equivalence classes, and a small amount of representative test data can be used to obtain better test results by taking one data in each equivalence class as the input condition of the test. There are two different cases of equivalence class division: effective equivalence class and invalid equivalence class.

1) efficient equivalence class

It refers to a collection of input data that is reasonable and meaningful for the specification of the program. The effective equivalence class can be used to verify whether the program achieves the function and performance specified in the specification.

2) invalid equivalence class

It is just the opposite of the definition of effective equivalence class. Invalid equivalence class refers to the collection of input data whose specification of the program is unreasonable or meaningless. For specific problems, there should be at least one or more invalid equivalence classes.

These two equivalence classes should be considered when designing test cases. Because the software should not only be able to receive reasonable data, but also be able to withstand unexpected tests, such testing can ensure that the software has higher reliability.

3. Criteria for dividing equivalence classes:

1) complete testing to avoid redundancy

2) the important thing to divide the equivalence class is that the set is divided into a set of disjoint subsets, and the subset is the whole set.

3) and is the whole set: completeness

4) disjoint subsets: guarantee a form of non-redundancy

5) identify (select) a test case in the same class. In the same equivalence class, the treatment is often the same, and the same processing is mapped to the "same execution path".

4. The method of dividing equivalence classes

1) when the input condition specifies the range or the number of values, one effective equivalence class and two invalid equivalence classes can be established. For example, the input value is the student score, and the range is 0100.

2) when the input condition specifies the set of input values or the condition of "what must be", a valid equivalence class and an invalid equivalence class can be established.

3) when the input condition is a Boolean quantity, a valid equivalence class and an invalid equivalence class can be determined.

4) when a set of values (assuming n) of the input data is specified, and the program needs to deal with each input value separately, n valid equivalence classes and one invalid equivalence class can be established.

For example, the input condition states that the educational background can be one of the four kinds of college, undergraduate, master and doctor, then take these four values as four effective equivalence classes, and take any degree other than the four qualifications as invalid equivalence class.

5) when the rules that must be followed by the input data are specified, a valid equivalence class (conforming to the rules) and several invalid equivalence classes (violating the rules from different angles) can be established.

6) in the case of knowing that the elements of the divided equivalence class have different ways of processing in the program, the equivalence class should be further divided into smaller equivalence classes.

5. Design test cases

After establishing the equivalence class, we can establish the equivalence class table and list all the input conditions of the divided equivalence class: effective equivalence class and invalid equivalence class, and then design the test case according to the following three principles from the divided equivalence class.

1) specify a unique number for each equivalence class

2) Design a new test case to cover as many valid equivalence classes as possible that have not been covered, and repeat this step until all valid equivalence classes are covered.

3) Design a new test case to cover only one invalid equivalence class that has not been covered, and repeat this step until all invalid equivalence classes are covered.

two。 Actual combat exercise

1. A certain program stipulates: "enter three integers a, b, c as the side length of the three sides to form a triangle. Through the program to determine the type of triangle, when the triangle is a general triangle, isosceles triangle and equilateral triangle, respectively." he said. The equivalent class partition method is used to design the test case for the program. The complexity of the triangle problem is that the relationship between input and output is complex. )

Analyze the requirements for input conditions given and implied in the title:

(1) integers (2) three numbers (3) non-zero numbers (4) positive numbers

(5) the sum of the two sides is greater than the third side (6) isosceles (7)

If a, b, c satisfy the condition (1) ~ (4), then one of the following four cases is output:

1) if the condition (5) is not met, the program output is "non-triangular".

2) if the three sides are equal, the condition (7) is satisfied, the program output is "equilateral triangle".

3) if only two sides are equal, that is, the condition (6) is satisfied, the program output is "isosceles triangle".

4) if the three sides are not equal, the program output is a "general triangle".

List and number the equivalence classes

Test cases that cover valid equivalence classes:

A b c overlay equivalence class number

3 4 5 (1)-(7)

4 4 5 (1)-(7), (8)

4 55 (1)-(7), (9)

5 4 5 (1)-(7), (10)

4 4 4 (1)-(7), (11)

Test cases that override invalid equivalence classes:

two。 There is a file management system that requires users to enter dates expressed in years and months. Suppose the date is limited to January 1990 to December 2049, and it is stipulated that the date consists of six numeric characters, with the first four digits representing the year and the last two representing the month. Now the equivalent class division method is used to design test cases to test the "date checking function" of the program.

1) the equivalence classes are divided and numbered. The results of the equivalence classes division in the following table

Input equivalence class effective equivalence class invalid equivalence class

Type and length of date ① 6-digit characters ② has non-numeric characters

③ is less than 6 digit characters

④ is more than 6 digit characters

The year range ⑤ is between 1990 and 2049. ⑥ is less than 1990.

⑦ is greater than 2049

The month range ⑧ is between 01 and 12, ⑨ equals 00

⑩ is greater than 12

2) Design test cases to cover all valid equivalence classes. Three valid equivalence classes are listed in the table, numbered ①, ⑤, ⑧, respectively. The designed test cases are as follows:

The effective equivalence Class of expected result coverage of Test data

200211 enter valid ①, ⑤, ⑧

3) Design a test case for each invalid equivalence class, and the design results are as follows:

Invalid equivalence classes covered by expected results of test data

Invalid 95June input ②

20036 invalid input ③

2001006 invalid input ④

198912 invalid input ⑥

200401 invalid input ⑦

200100 invalid input ⑨

200113 invalid input ⑩

The 3.NextDate function contains three variables: month, day, and year, and the output of the function is the date one day after the input date. For example, if the input is March 7, 2006, the output of the function is March 8, 2006. The input variables month, day, and year are required to be integer values and the following conditions are met:

① 1 ≤ month ≤ 12

② 1 ≤ day ≤ 31

③ 1920 ≤ year ≤ 2050

1) valid equivalence classes are:

M1 = {month: 1 ≤ month ≤ 12}

D1 = {date: 1 ≤ date ≤ 31}

Y1 = {year: 1812 ≤ year ≤ 2012}

2) if any of the conditions ① ~ ③ fails, the NextDate function will produce an output indicating that the corresponding variable is outside the range of values, such as "the value of month is not in the range of 1-12". Obviously, there are a large number of invalid combinations of year, month, and day, and the NextDate function cooperates these groups into a unified output: "invalid input date". Its invalid equivalent classes are:

M2 = {month: month 12}

D2 = {date: date 31}

Y2 = {year: 2012}

Weak general equivalence class test case

Month, date, year expected output

6 15 1912 16 June 1912

Strong general equivalent class test cases are the same as weak general equivalent class test cases

Note: weak-single defect hypothesis; robust-invalid values are considered

(1) weak and robust equivalence test

Use case ID month date year expected output

WR1 6 15 1912 June 16, 1912

WR2-1 15 1912 is not in January 12.

WR3 13 15 1912 is not in January 12

WR4 6-1 1912 date is not in 1: 31

WR5 6 32 1912 date is not in 1: 31

WR6 6 15 1811 is not in 1812 / 2012.

WR7 6 15 2013 is not in 1812 2012

(2) robust equivalence test

Use case ID month date year expected output

SR1-1 15 1912 is not in January 12.

SR2 6-1 1912 date is not in 1: 31

SR3 6 15 1811 is not in 1812 / 2012.

SR4-1-1 1912 two invalid and one valid

SR5 6-1 1811 two invalid and one valid

SR6-1 15 1811 two invalid and one valid

Three invalid SR7-1-1 1811

4. The commission problem equivalence class test case, which defines the equivalence class according to the output range of the commission function, to improve the test case set.

Export sales ≤ 1000 yuan commission 10%

10001800 commission = 220 + (sales-1800)

Test case gun machine (45) gun butt (30) gun barrel (25) sales commission

1 5 5 5 500 50

2 15 15 15 1500 175

3 25 25 25 2500 360

The input value is selected according to the output domain so that it falls into the equivalence class of the output domain and can be combined with weak robust test cases.

Boundary value analysis method:

one。 Brief introduction of the method

1. Definition: boundary value analysis is a black box test method to test the boundary values of input or output. Usually, the boundary value analysis method is used as a supplement to the equivalence class division method. in this case, the test case comes from the boundary of the equivalence class.

two。 The difference between equivalent partition and equivalent partition

1) Boundary value analysis does not take any one of the equivalence classes as a representative, but makes each boundary of the equivalence class as a test condition.

2) the boundary value analysis takes into account not only the input conditions, but also the test conditions generated by the output space.

3. Consideration of boundary value analysis method:

Long-term testing experience tells us that a large number of errors occur at the boundaries of the input or output range, not within the input and output range. Therefore, more errors can be found by designing test cases for various boundary situations.

Using the boundary value analysis method to design test cases, the boundary condition should be determined first. Usually the boundary of the input and output equivalence classes is the boundary case that should be tested. You should select values that are exactly equal to, just greater than or less than the boundary, as test data, rather than typical or arbitrary values in the equivalence class as test data.

4. Common boundary values

1) for integers of 16-bit, 32767 and-32768 are boundaries

2) the cursor on the screen is at the top left and bottom right.

3) the first and last rows of the report

4) the first and last elements of the array

5) the 0th, 1st and penultimate and last times of the cycle

5. Boundary value analysis

1) the boundary value analysis uses the same partition as the equivalent class partition method, but the boundary value analysis assumes that more errors exist on the boundary of the division, so test cases are designed on the boundary of the equivalence class and on both sides.

Example: test the function that calculates the square root

-- enter: real number

-- output: real number

-- Specification: returns the positive square root when entering a number of 0 or greater than 0; when entering a number less than 0, the error message "illegal square root-input value less than 0" is displayed and returns 0; the library function Print-Line can be used to output error messages.

2) equivalent category division:

i. You can consider making the following division:

A, input (I) = 0

B, output (a) > = 0 and (b) Error

ii. There are two test cases:

A, input 4, output 2. Corresponds to (ii) and (a).

B, input-10, output 0 and error prompt. Corresponding to (I) and (b).

3) Boundary value analysis:

The boundary of ii is 0 and the largest positive real number, and the boundary of partition (I) is the minimum negative real number and 0. As a result, the following test cases are obtained:

A, enter {minimum negative real number}

B, enter {negative number with very small absolute value}

C, enter 0

D, enter {positive number with very small absolute value}

E, enter {maximum positive real number}

4) in general, there are several types of boundary checks included in software testing: numbers, characters, position, weight, size, speed, azimuth, size, space, etc.

5) accordingly, the boundary values of the above types should be in the cases of maximum / minimum, first / last, top / bottom, fastest / slowest, highest / lowest, shortest / longest, empty / full, etc.

6) using boundary value as test data

The Design idea of item Boundary value Test case

Character start-1 character / end + 1 character assumes that a text input area allows you to enter 1 to 255 characters, enter 1 and 255 characters as valid equivalence classes, and enter 0 and 256 characters as invalid equivalence classes. these values belong to boundary condition values.

Numerical minimum-1 / maximum + 1 assumes that the data input field of some software requires 5-bit data values, with 10000 as the minimum value and 99999 as the maximum value; then use values that are just less than 5 bits and greater than 5 bits as boundary conditions.

The space is a little less than the free space / a little more than the full space, for example, when using a flash drive to store data, use a file with a little more than the remaining disk space (several KB) as the boundary condition.

7) Internal boundary value analysis:

In most cases, boundary value conditions are factors that need to be considered based on the functional design of the application, which can be obtained from the specification or common sense of the software, and the problem can be easily found by the end user. However, in the process of test case design, some boundary value conditions do not need to be presented to the user, or it is difficult for the user to notice, but they do belong to the boundary conditions within the scope of the test. it is called internal boundary value condition or sub-boundary value condition.

The main internal boundary value conditions are as follows:

A) numerical boundary value test: the computer works based on the binary system, so any numerical operation of the software has a certain range.

Item range or value

Bit (bit) 0 or 1

Byte (byte) 0Mui 225

Word (word) 0mm 65535 (word) or word 4294967295 (double word)

Thousand (K) 1024

Trillion (M) 1048576

Ji (G) 1073741824

B) check the boundary value of characters: in computer software, characters are also very important representation elements, in which ASCII and Unicode are common coding methods. The ASCII code values for some common characters are listed in the following table.

Character ASCII code value character ASCII code value

Null (null) 0 A 65

Space (space) 32 a 97

Slash (/) 47 Z 90

0 48 z 122

Colon (:) 58 single quotation mark (') 96

@ 64

C) other boundary value tests

6. The principle of selecting Test cases based on Boundary value Analysis

1) if the input condition specifies a range of values, the value that has just reached the boundary of the range and the value that has just exceeded the boundary of the range should be taken as the test input data.

For example, if the specification of the program states: "for mail weighing between 10 kg and 50 kg, the postage calculation formula is …"... " . As test cases, we should take 10 and 50, as well as 10.01, 49.99, 9.99 and 50.01.

2) if the input condition specifies the number of values, the maximum number, the minimum number, one less than the minimum number and one more than the maximum number are used as the test data.

For example, if an input file should contain 1, 255 records, test cases should be 1 and 255, 0 and 256, and so on.

3) apply rules 1) and 2) to the output condition, that is, design test cases to make the output value reach the boundary value and its left and right values.

For example, the specification of a program requires the calculation of "monthly insurance deduction of 0 to 1165.25 yuan". The test cases can be 0. 00 and 1165.24, 0. 01 and 1165.26, etc.

Another example is that a program belongs to an information retrieval system, which requires "at least one display and a maximum of four information summaries" at a time, and the test cases we should consider include 1 and 4, as well as 0 and 5, etc.

4) if the input field or output field given by the specification of the program is an ordered set, the first and last elements of the set should be selected as the test case.

5) if an internal data structure is used in the program, the value on the boundary of the internal data structure should be selected as the test case.

6) analyze the specification and find out other possible boundary conditions.

two。 Actual combat exercise

1. There is now a procedure for students to pass standardized exams to mark papers and produce performance reports. The specification is as follows: the input file of the program consists of records with 80 characters, as shown in the figure on the right, all records are divided into three groups:

① title: there is only one record in this group, which is the name of the output performance report.

The standard answer record of each question in the ② paper: each record is marked with the number "2" at the 80th character. The first to third characters of the first record in this group are title numbers (values are 1-999). The 10th to 59th characters give answers to questions 1 to 50 (each legal character represents an answer). The second and third in this group. The corresponding records are 51 to 100, 101 to 150, … The answer to the question.

③ description of each student's answer paper: the 80th character of each record in this group is the number "3". Each student's answer paper is given in several records. If the first record of A gives the student's name and student number in characters 1 to 9, characters 10 to 59 list the answers to questions 1 to 50 done by A. If the number of questions exceeds 50, then the second and third. The records give him 51 to 100, 101 to 150 respectively. The answer to the question. Then there is the answer record of student B.

The number of ④ students does not exceed 200 and the number of examination questions does not exceed 999.

The output of the ⑤ program has four reports:

A) A transcript arranged by student number, listing each student's grades and rankings.

B) transcripts sorted by student grades

C) report of average scores and standard deviations

D) Analysis report of examination questions. Sort by question number and list the percentage of students who answered each question correctly.

Answer: input conditions and output conditions, as well as boundary conditions are considered respectively. The input conditions shown in the following table and the corresponding test cases are given.

Output conditions and the corresponding test case table.

two。 Boundary value Analysis Test case of Triangle problem

In the description of the triangle problem, there are no other restrictions except that the side length is required to be an integer. Here, we set the range of the length of each side of the triangle to [1100].

Boundary value Analysis Test case of 3.NextDate function

In the NextDate function, it is implicitly specified that the value range of variable mouth and variable day is 1 ≤ mouth ≤ 12 and 1 ≤ day ≤ 31, and the value range of variable year is 1912 ≤ year ≤ 2050.

Wrong conjecture method

one。 Brief introduction of the method

Definition: a method of designing test cases based on experience and intuition to speculate all possible errors in the program. The basic idea of misguessing method:

List all possible errors and error-prone special cases in the program, and select test cases according to them.

1) for example, if the input and output data are 0, the input table is blank or the input table has only one row. These are all error-prone situations. Examples in these cases can be selected as test cases.

2) for example, for the performance reporting program in the previous example, the error inference method can be used to supplement the design of some test cases:

i. Whether the program takes a space as an answer

ii. There is a standard answer record in the answer record.

iii. In addition to the title record, there are some records whose last character is neither 2 nor 3.

iv. There are two students with the same student number

v. The number of questions is negative.

3) for example, testing a program that sorts linear tables, such as arrays, can speculate to list the following situations that require special testing:

i. The input linear table is empty

ii. The table contains only one element

iii. All the elements in the input table have been sorted

iv. The input table has been arranged in reverse order

v. Some or all of the elements in the input table are the same.

two。 Actual combat exercise

None for the time being

Causality diagram method

one。 Brief introduction of the method

1. Definition: it is a method to design test cases by using graphical method to analyze various combinations of inputs. It is suitable for checking various combinations of program input conditions.

two。 The background of causality diagram method:

Both the equivalent class division method and the boundary value analysis method focus on the input conditions, but do not take into account the various combinations of input conditions and the mutual restriction between the input conditions. In this way, although the situation in which various input conditions can go wrong has been tested, the situation in which multiple input conditions can go wrong is ignored.

If various combinations of input conditions must be considered in the test, the number of possible combinations will be astronomical. Therefore, it is necessary to consider the design of test cases in a form that is suitable for describing multiple conditions and generating multiple actions, which requires the use of causality diagrams (logical models).

3. Introduction of causality diagram

1) the four symbols represent the four kinds of causality in the specification respectively.

2) A simple logical symbol is used in the causality diagram to connect the left and right nodes in a straight line. The left node represents the input status (or cause), and the right node represents the output status (or result).

3) Ci indicates the cause, usually on the left side of the graph; ei represents the result, usually on the right side of the graph. Both Ci and ei can have a value of 0 or 1, indicating that a certain state does not appear, and 1 indicates that a certain state occurs.

The concept of causality diagram

1) relationship

① identity: if ci is 1, ei is also 1; otherwise ei is 0.

② is not: if ci is 1, ei is 0; otherwise ei is 1.

③ or: if C1 or c2 or c3 is 1, ei is 1; otherwise ei is 0. "or" can have any input.

④ and: if both C1 and c2 are 1, ei is 1; otherwise ei is 0. "and" can also have any input.

2) constraint

Input states may also have some dependencies on each other, called constraints. For example, some input conditions themselves cannot appear at the same time. There are also often constraints between output states. In the causality diagram, these constraints are marked with specific symbols.

a. There are four types of constraints for input conditions:

① E constraint (different): at most one of an and b can be 1, that is, an and b cannot be 1 at the same time.

② I constraint / OR: at least one of a, b, and c must be 1, that is, a, b, and c cannot be 0 at the same time.

③ O constraint (unique); an and b must have one, and only one is 1.

④ R constraint (requirement): if an is 1, b must be 1, that is, it is impossible that an is 1 and b is 0.

b. Output condition constraint type

The constraint of the output condition is only the M constraint (mandatory): if the result an is 1, the result b is forced to 0.

Steps to design test cases using causality diagrams:

1) in the specification description of the analysis software, which are the causes (that is, the equivalent class of input conditions or input conditions), and those are the results (that is, output conditions), and each reason and result is assigned an identifier.

2) analyze the semantics in the description of software specification, find out the corresponding relationship between cause and result, cause and cause, and draw the causality diagram according to these relations.

3) due to grammatical or environmental restrictions, the combination of some reasons and causes and between causes and results is impossible. In order to show these special cases, some symbols are used to indicate the constraints or constraints on the causality diagram.

4) convert the causality diagram into a decision table.

5) take out each column of the decision table as a basis to design test cases.

two。 A software specification contains the following requirements: the first column of characters must be An or B, and the second column of characters must be a number, in which case the file is modified, but if the first column of characters is incorrect, the information L is given; if the second column of characters is not a number, the information M is given.

Answer:

1) according to the meaning of the topic, the reasons and results are as follows:

Reason:

1mi-the first column of characters is A

2mi-the first column of characters is B.

3mi-the second column of characters is a number.

Results:

21Mui-modify the file

22-give information L

23mura-give information M.

2) the corresponding causality diagram is as follows:

11 is the intermediate node; considering that reason 1 and cause 2 cannot be 1 at the same time, E constraint is imposed on the causality diagram.

3) establish the decision table according to the causality diagram.

In the two left columns of the eight cases in the table, both reason ① and reason ② are 1, which is impossible, so these two cases should be excluded. The bottom column of the table shows the test cases for six cases, which is the data we need.

two。 There is a design of a vending machine software test case that deals with drinks priced at 50 cents per unit. The specifications are as follows: if you put in a coin of 50 cents or 1 yuan and press the button of [orange juice] or [beer], the corresponding drink will be delivered. If there is no change in the vending machine, a red light showing [change] is on. After putting in the 1 yuan coin and pressing the button, the drink will not be sent out and the 1 yuan coin will be returned; if there is change, the red light showing [change] is off, and the 50 cents coin is returned while sending out the drink.

1) analyze the description of this paragraph and list the reasons and results

Reason:

1. There is change for the vending machine

two。 Put in an one-yuan coin

3. Put in a fifty cent coin

4. Put down the orange juice button

5. Press the beer button

Results:

21. The vending machine [change] light is on.

twenty-two。 Refund an one-dollar coin

23. Refund the fifty cents

24. Send out orange juice drinks

25. Send out beer and drinks

2) draw the causality diagram, as shown in the figure. All cause nodes are listed on the left and all result nodes are listed on the right. An intermediate node is established to represent the intermediate state of the processing. Intermediate node:

If you put in an one-yuan coin and press the drink button and press the [orange juice] or [beer] button, you should have change for 50 cents and the vending machine has change and has paid off.

3) convert to decision table:

4) in the decision table, the shaded part indicates that it is impossible to occur due to violation of the constraint condition, and delete it. Columns 16 and 32 were deleted because they did nothing. Finally, the remaining 16 columns can be used as the basis for determining the test case.

Decision table-driven analysis method

one。 Brief introduction of the method

1. Definition: a decision table is a tool for analyzing and expressing different operations under multiple logical conditions.

two。 Determine the advantages of a table

Be able to list complex problems according to all possible situations, be concise and avoid omissions. Therefore, a complete set of test cases can be designed by using the decision table.

In some data processing problems, the implementation of some operations depends on the combination of multiple logical conditions, that is, different operations are performed according to the combined values of different logical conditions. The decision table is very suitable for dealing with such problems.

3. Reading Guide decision Table

The decision table usually consists of four parts, as shown in the following figure.

1) conditional pile (Condition Stub): lists all the conditions of the problem. It is generally considered that the order of the conditions listed does not matter.

2) Action pile (Action Stub): lists the possible actions to be taken by the problem. There is no constraint on the order in which these operations are arranged.

3) condition item (Condition Entry): lists the values for its left column of conditions. True and false values in all possible cases.

4) Action Entry: lists the actions that should be taken in the case of various values of the condition item.

5. Rules and rules merging

1) rules: the specific values of any combination of conditions and the corresponding actions to be performed are called rules. A column that runs through condition items and action items in the decision table is a rule. Obviously, to determine how many sets of condition values are listed in the table, there are as many rules, that is, how many columns there are for condition and action items.

2) Simplification: rule merging means that two or more rules have the same action, and there is a very similar relationship between the condition items.

6. Examples of rules and rules merging

1) at the left end of the figure below, the two rule action items are the same, and the condition items are similar. When condition 1 and condition 2 take Y and N respectively, no matter what the value of condition 3 is, the same operation is performed. That is, the action to be performed has nothing to do with condition 3. So it can be merged. "-" means it has nothing to do with the value.

2) similar to the above, in the following figure, the irrelevant condition item "-" can contain values of other condition items, and rules with the same action can be merged.

3) the simplified reading guide judgment table

1 2 3 4

Ask

Do you feel tired? -- Y N

Are you interested in the content? Y Y N N

Does the content of the book confuse you? Y N--

Build

Please go back to the beginning of this chapter and reread x

Keep reading, X.

Skip to the next chapter to read x

Stop reading, please rest x

7. Steps to establish the decision table: (according to the software specification)

1) determine the number of rules. If there are n conditions. Each condition has two values (0 # 1), so there are 2n rules.

2) list all conditional piles and action piles.

3) fill in the condition item.

4) enter the action item. Wait until the initial decision table.

5) simplification. Merge similar rules (same actions).

two。 Actual combat exercise

1. The question requires: "... priority should be given to machines with power greater than 50 horsepower, machines with incomplete maintenance records or machines that have been running for more than 10 years." . It is assumed that "incomplete maintenance records" and "priority maintenance treatment" have been more strictly defined elsewhere. Please establish a decision table.

Answer:

① determines the number of rules: there are three conditions, each of which has two values, so there should be 222-8 rules.

② lists all the conditional stubble and action piles:

③ fill in the condition item. You can start with the last line of conditional items and fill them up line by line. For example, the third line is: Y N Y N Y N Y N, the second line is: Y Y N N Y Y N N and so on.

④ fill in the action pile and action top. In this way, the initial decision table in the form of a graph is obtained.

1 2 3 4 5 6 7 8

Strip

Is the power greater than 50 horsepower? Y Y Y Y N N N N

Is the maintenance record incomplete? Y Y N N Y Y N N

Has it been running for more than 10 years? Y N Y N Y N Y N

Move

To give priority to x x X X X

For other processing X x x

Initial decision table

⑤ simplification. The graph is obtained after merging similar rules.

1 2 3 4 5

Strip

Is the power greater than 50 horsepower? Y Y Y N N

Is the maintenance record incomplete? Y N N--

Has it been running for more than 10 years? -Y N Y N

Move

To give priority to x x X

For other treatments x x

Reduced decision Table of 2.NextData function

M1 = {month, there are 30 days per month}

M2 = {month, 31 days per month}

M3 = {month, February} there are 290512 rules

D1 = {date, 1: 28} late December 31 and other 31

D2 = {date, 29} different treatment on the 31st of the day and month

D3 = {date, 30} February 28 of the usual year is handled differently

D4 = {date, 31} on February 27th

Y1 = {year: year is a leap year}

Y2 = {year: year is not a leap year}

Improved to

M1 = {month: 30 days per month}

M2 = {month: 31 days per month, except December}

M4 = {month: December}

M3 = {month: February}

D1 = {date: 1

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report