Practice Exams:

# ISTQB CTFL-2018 – 2018: Test Design Techniques Part 2

1. Boundary Value Analysis

Boris PISR and American Software Engineering author says that bugs lock in corners and congregate at boundaries. One thing we know about the kinds of mistakes that programmers make is that errors tend to cluster around boundaries. Some developers might get confused about our employee age and unintentionally get confused about the numbers 20, n, 50 and boot them out of range.

A developer might use the wrong comparison sign and use less than, instead of less than or equal or vice versa. There are many ways developers can make such mistakes. Boundary value analysis works hand in hand with our equivalence boutitioning from the previous lectures because boutitions have boundaries but can only be used when the boutation is ordered. Consisting of numeric or sequential data, the minimum and maximum values of first and last values of the partition are its boundary values. In our embly age, where we have the accepted embly age in the range from 20 to 50, we had three boutitions. So we need to identify the boundaries for each partition.

The first partition, 20 to 50, has the boundaries of 20 and 50 which are valid boundaries, assuming we can limit the input so no negative numbers are allowed. The second partition, less than 20, has a boundary of zero and 19. The third partition, above 50 has a boundary of 51. And there is no second boundary in this partition because it extends to bossed infinity. The technique used here is called two values bare boundary, meaning if we look from the valid partition point of view for the lower boundary we identify the value at the boundary and the value just below the lower boundary. And for the higher boundary as tested values, we identify the values, add the boundary and the value just above the higher boundary as tested values.

So the boundary between invalid too low and valid gives the test values 19 and 20 and the boundary between valid and invalid too high provides the tests with value 50 and 51. Some variations of this technique identify three boundary values bare boundary where for each boundary we identify the value at the boundary and the value just before the boundary and after the lower of the boundary. In the previous example, using three point boundary values for the valid partition, the lower boundary test values are 1920 and 21 and the above boundary test values are 49, 50 and 51. In the exam, they will state it clearly if they want you to calculate the test values using three point boundary value analysis. If they didn’t indicate which technique to use, then consider two. Value boundary value analysis.

So to solve the boundary value analysis questions right, you must identify the partitions correctly and identify the boundaries of each partition. Your test cases should use the exact boundaries you have just identified. Boundary value address can be applied at all test levels. This technique is generally used to test requirements that call for a range of numbers, including dates, and times. Boundary coverage for about ten is measured as the number of boundary value tested divided by the total number of identified boundary test values generally expressed as a percentage. So considering two point boundary value analysis in our employee age example, we agreed that we have the following boundaries 00:19 2051 so we have five boundaries.

If the testers decided to consider three boundaries only in this design test cases, then the coverage would be three divided by five multiplied by 100 equals 60%. Let’s look at a more complicated boundary value and as an example to confirm our understanding, again, you need to be very careful with the wording of the question. All what we need to do is define the partitions correctly with its boundaries. The question didn’t specify if we should use two point boundary value analysis or three point boundary value analysis. So we can consider two point boundary value analysis safely. So looking at the question, bank fee is 0% for balance less than \$500. What will be the boundaries of this partition? Yes, we will start from zero but what will be the higher boundary in this partition? Notice that it says here less than 500. So in that case \$499 or to be more accurate, \$499. 99 will be the higher boundary for this partition. Again, warnings are the tricky part in this kind of questions.

So from zero to 499. 99 we will have 0% bank fee. The following partition will start from \$500 and again looking at the question we will pay 2% for less than \$1,000. So what will be the above boundary for this partition? Yes, it will be \$999. 99. So the second partition will be from 500 to 999. 99. The following partition is from 1000 or more. So from 1000 up to infinity we will be 4% bank fee. Looking at the question itself, what are they actually looking for? They are looking for valid boundary analysis. So we are just defining the valid boundaries here. So we have three partitions from zero to 499. 99 and the second one from 500 to 999.

99 and the third partition from 1000 to infinity. So which choice is ours? Actually, this is the simplest part of boundary value analysis questions. Once you have defined the partitions correctly and the boundaries precisely, then the answer is just in front of your eyes right now. For valid boundary value analysis I will just say without looking at any of the choices it will be zero, 499. 99, 500, 999. 99 and 1000. The numbers that you wrote with your own hands are the correct choice. So looking at the answer options we can simply discard the choice C because it contains a negative value and we are looking only for valid boundary values. Choice D seems very small, it doesn’t contain any 499 values. So we can also discard the choice D from our list. Looking at choice A we notice that it has many test inputs 0. 1, 499. 99 and so on. So choice A is not correct. When we were driving our test cases, we use the two point boundary value analysis technique. If the question asked it for three point boundary value analysis, the answer would be choice A.

But a choice A is there to confuse you. So remember, they usually ask exactly if they want three point value. Actually, like let’s be more clear here. If we examined choice B and it turned out to be incorrect as well, then we can make a choice A here. So even though they haven’t directly asked it for three point boundary value analysis, but if the only correct answer was the three point boundary value analysis values, then be it. We will not pick long values anyway. So I hope this is clear, saying that looking at the values of a choice B zero, yes, 499. 99 yes, 500, 999. 99 and 1000. So after examining the values of a choice B, the correct answer would be choice B. Again, those kind of questions are very tricky in the wording. So we have to be very relaxed while reading the words. Use your pencil or pen or whatever just to go through the question word by word and draw the ball as I did and the numbers will just pop up in front of your eyes very smoothly. I hope you get the idea of those kinds of questions.

1. Decision Table Testing

Some specifications contain that complicated logical conditions or complex business rules. Different combinations of conditions could use different actions as testers. We need to be able to assure ourselves that every combinations of these conditions that might occur has been tested. So we need to capture all the decisions in a way that enables us to explore their combinations. That’s where decision table testing is distinguished. Let’s start by an example to understand it better.

A company that sells car insurance asked you to develop a software for them. The software requirement for calculating car insurance premiums is for females between 18 and 64 years of age, the premium is \$500. For males between 18 and 64 years of age, the premium is \$1,000. For any 65 years of age or more, the premium is one \$500. Anyone less than 18 years of age cannot get insurance. The question is what is the minimum number of test cases needed to test this requirement? The decision table contains a triggering condition, often combinations of true and false for all input conditions and the resulting actions for each combinations of conditions. Let’s start by building together the decision table for this piece of requirement. A decision table lists all the input conditions that can occur at the top of the table and the actions that can arise from them at the bottom of the table.

So we would have male, female, less than 18, between 18 and 65 and older than 65 as input conditions. And we also have 501,001, 500 and not applicable as possible actions to be taken by the system. Business rules, which are combinations of conditions to reduce some actions, are arranged across the top horizontally. Therefore, each column represents a single business rule and shows how input conditions combine to produce actions. Let’s try all the possible combinations in our example. So let’s build the vision table together. In the first column we’re going to put one in front of male, which means we are talking about males and one in front of less than 18.

So for males and less than 18 years of age they will be well, it’s not applicable. So we’re going to put one in front of not applicable. In the second column we’re going to put one in front of male and one in front of more than or equal 18 and less than 65. So if we have a male and he’s in the age range of more than or equal 18 and less than 65, how much he will be?

He will pay \$1,000. So we’re going to put one in front of 1000 and zeros in front of every other row and we’re going to continue in the same scenario of the same sequence for the remaining columns. And we’re going to end up with six columns. We must make sure that we have exercised all possible combinations of conditions, both valid and invalid combinations. In our case, we have four valid combination and two invalid combinations to achieve fault coverage, we should have at least one test bare column in the decision table. So we should have six test cases to achieve full coverage in our example. And remember, test cases contain actual data. Here we’re going to try then 16 as representative for the first column, zone 40 as representative for the second column and so on. We have sam 70, joanna 66. Limba 14, sue 32.

The decision table could be a good tool to evaluate the requirement as during building the table we might discover some combinations of conditions have not been mentioned at all in the requirement, which in that case we should go back to the system analyst and ask for clarification. The questions in the Http exam related to the vision table testing vary. One example might give you the table and the situation of the specific combinations of conditions and ask you what the action should be. So if we have David who is 43 years old, so how much he should pay for premium, the answer would be \$1,000. Or they might give you a ready made test cases and ask you what are the remaining needed test cases to achieve full coverage? The hardest one of all would be like.

1. State Transition Diagram

The state transition technique is concerned with systems that may exhibit a different response depending on current conditions or previous history, which is its state. The previous history can be summarized using the concept of states. A state transition diagram shows the possible software states as well as how the software enters exits and transitions between states. A transition is initiated by an event, for example, user input of a value into a field. The event results in a transition state. Transition diagrams allows a tester to view the software in terms of its states, transitions between states, the inputs or events that trigger state changes which are transitions, and the actions which may result from those transitions.

The system may behave differently to the same trigger or transition according to its current state. Let’s look at an example of a state position diagram to learn more about it. This diagram represents a marital status system. Take a look at it for a second to see if you can get the idea of such diagrams by yourself. I think you can do it by yourself blindly. Circles represent states and ours represent transitions or events that would happen on a specific state that will cause that change of the county state. To read this diagram, start with the dark circle in the diagram, wherever it is. This is usually the start point of the diagram. A person starts by being a single person. Then he could only be married or stay in the single state forever. I hope not. While in married state, one of two things can happen move to separated state or move to widowed state. In separated state, one of two things can happen move to divorced state or move to widowed state.

While in widowed state or divorced state, you can remarry and hence move back to the married state. Note that not all events have an effect in all states. Where an event doesn’t have an effect on a given estate, it’s usually omitted, but it can be shown as an hour starting from the state and returning to the same state to indicate that no transition takes place. This is sometimes known as a null transition or an invalid transition. In our example, you cannot get remarried while you are separated. State transition diagrams normally show only the valid transitions and exclude invalid transitions. Such relationships between the state and the transitions can be more clear if we create what’s known as a state table. A state table records also possible valid or invalid transitions, guard conditions and their effect on all possible states. For each combination of event and state. It shows the outcome in terms of the new state and any outputs that are generated.

So for the sake of creating the transition table, let’s give titles to the transitions in our example. Whether you are dealing with state transition diagrams or tables, tests can be designed to COVID a typical sequence of states to COVID every state, to exercise every transition to exercise a specific sequence of transitions or to test invalid transitions. And this is where most of the questions in the exam are about, for example, how many test cases are needed to go through all the transitions. In our example, also, again, one taster case is enough, but it’s a different one than the previous one. Single, married, widowed, married, separated, divorced, married, separated, widowed. Which sequences of estates are valid and which are not? In our example, single, married, single is not a valid transition. You cannot be single again, ever you wish. Estate transition testing is used for menu based applications and is widely used within the embedded software industry.

Yeah, just remember, state transition testing is widely used within the embedded software industry. The technique is also suitable for modeling a business scenario having specific states or for testing screen navigation. The concept of a state is abstract. It may represent a few lines of code or an entire business process. Coverage is commonly measured as the number of identified states or transitions tested, divided by the total number of identified states or transitions in the test object. Normally, it’s raised as a percentage. The syllabus indicates that to know more about state transition coverage, we can look at the test advanced level syllabus. So let’s keep it this way and leave it for the advanced level. Estate position diagrams are much more than that. You can learn more about estate transition diagrams from my UML course. You can find a cobone for it in the last lecture of this course. You.